From 347301830a8b522f1d9d717c9191a0a1377d1622 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Fri, 9 Aug 2024 14:07:02 -0700 Subject: [PATCH] AI nonsense --- src/widgets/linkwarden/component.jsx | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/src/widgets/linkwarden/component.jsx b/src/widgets/linkwarden/component.jsx index 657d8b11..5803b9c7 100644 --- a/src/widgets/linkwarden/component.jsx +++ b/src/widgets/linkwarden/component.jsx @@ -7,21 +7,19 @@ import useWidgetAPI from "utils/proxy/use-widget-api"; export default function Component({ service }) { const { widget } = service; - // State to hold Stats const [stats, setStats] = useState({ totalLinks: null, collections: { total: null }, tags: { total: null }, }); - const { data: collectionsStatsData, error: collectionsStatsError } = useWidgetAPI(widget, "collections"); // Fetch Collection Stats - const { data: tagsStatsData, error: tagsStatsError } = useWidgetAPI(widget, "tags"); // Fetch Tag Stats + const { data: collectionsStatsData, error: collectionsStatsError } = useWidgetAPI(widget, "collections"); + const { data: tagsStatsData, error: tagsStatsError } = useWidgetAPI(widget, "tags"); - // Effect to update Stats when collectionsStatsData or tagsStatsData changes useEffect(() => { if (collectionsStatsData?.response && tagsStatsData?.response) { - /* eslint-disable no-underscore-dangle */ setStats({ + // eslint-disable-next-line no-underscore-dangle totalLinks: collectionsStatsData.response.reduce((sum, collection) => sum + (collection._count?.links || 0), 0), collections: { total: collectionsStatsData.response.length, @@ -30,7 +28,6 @@ export default function Component({ service }) { total: tagsStatsData.response.length, }, }); - /* eslint-enable no-underscore-dangle */ } }, [collectionsStatsData, tagsStatsData]); @@ -38,7 +35,6 @@ export default function Component({ service }) { return ; } - // Render when data is available return (