From ddcf092678b95845a120ef0f765ef6a8ac9e8c2f Mon Sep 17 00:00:00 2001 From: Subho Date: Fri, 12 Jul 2024 18:37:10 +0530 Subject: [PATCH] Add empty dependency array to useEffect hook This limits the file watch listener to only attach once and not on every render which is unnecessary. --- src/app.tsx | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/app.tsx b/src/app.tsx index 693dd517..0d3b12fd 100644 --- a/src/app.tsx +++ b/src/app.tsx @@ -32,7 +32,7 @@ export const Application = () => { const hostname = cockpit.file('/etc/hostname'); hostname.watch(content => setHostname(content?.trim() ?? "")); return hostname.close; - }); + }, []); return (