From 08e3164e84a3326c0447b9e48799acb3664dac44 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Sun, 10 Sep 2023 07:39:36 -0700 Subject: [PATCH] Detect custom css / js changes, no refresh --- src/components/filecontent.jsx | 6 ++---- src/pages/api/hash.js | 2 +- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/src/components/filecontent.jsx b/src/components/filecontent.jsx index 6db30d18..e99cbb87 100644 --- a/src/components/filecontent.jsx +++ b/src/components/filecontent.jsx @@ -1,10 +1,8 @@ import useSWR from "swr" -export default function FileContent({ path, loadingValue, errorValue, emptyValue = '', refresh = 1500 }) { +export default function FileContent({ path, loadingValue, errorValue, emptyValue = '' }) { const fetcher = (url) => fetch(url).then((res) => res.text()) - const { data, error, isLoading } = useSWR(`/api/config/${ path }`, fetcher, { - refreshInterval: refresh, - }) + const { data, error, isLoading } = useSWR(`/api/config/${ path }`, fetcher) if (error) return (errorValue) if (isLoading) return (loadingValue) diff --git a/src/pages/api/hash.js b/src/pages/api/hash.js index 0e8d0261..b14a0627 100644 --- a/src/pages/api/hash.js +++ b/src/pages/api/hash.js @@ -4,7 +4,7 @@ import { readFileSync } from "fs"; import checkAndCopyConfig, { CONF_DIR } from "utils/config/config"; -const configs = ["docker.yaml", "settings.yaml", "services.yaml", "bookmarks.yaml", "widgets.yaml"]; +const configs = ["docker.yaml", "settings.yaml", "services.yaml", "bookmarks.yaml", "widgets.yaml", "custom.css", "custom.js"]; function hash(buffer) { const hashSum = createHash("sha256");