From 7b474d4cef3a7ee42af32c735593b97bbe23e057 Mon Sep 17 00:00:00 2001 From: shamoon <4887959+shamoon@users.noreply.github.com> Date: Wed, 8 Feb 2023 00:19:33 -0800 Subject: [PATCH] Revert "Merge pull request #609 from benphelps/fix-576" This reverts commit a7f290dfdd583c8c9696c71d93a9c39a2348bf2d, reversing changes made to cf3839510045cc51cf4d653dabb83477e9743d80. --- src/pages/index.jsx | 4 ++-- src/utils/config/config.js | 17 ++--------------- 2 files changed, 4 insertions(+), 17 deletions(-) diff --git a/src/pages/index.jsx b/src/pages/index.jsx index 152f28f19..9aff3c0e0 100644 --- a/src/pages/index.jsx +++ b/src/pages/index.jsx @@ -100,7 +100,7 @@ function Index({ initialSettings, fallback }) { localStorage.setItem("hash", hashData.hash); } - if (!initialSettings.isValid || (previousHash && previousHash !== hashData.hash)) { + if (previousHash && previousHash !== hashData.hash) { setStale(true); localStorage.setItem("hash", hashData.hash); @@ -112,7 +112,7 @@ function Index({ initialSettings, fallback }) { } } } - }, [hashData, initialSettings]); + }, [hashData]); if (stale) { return ( diff --git a/src/utils/config/config.js b/src/utils/config/config.js index 0415cfca5..57a63f7b4 100644 --- a/src/utils/config/config.js +++ b/src/utils/config/config.js @@ -1,6 +1,6 @@ /* eslint-disable no-console */ import { join } from "path"; -import { existsSync, copyFile, readFileSync, statSync } from "fs"; +import { existsSync, copyFile, readFileSync } from "fs"; import yaml from "js-yaml"; @@ -32,18 +32,5 @@ export function getSettings() { const settingsYaml = join(process.cwd(), "config", "settings.yaml"); const fileContents = readFileSync(settingsYaml, "utf8"); - - let stats; - try { - stats = statSync(settingsYaml); - } catch (e) { - stats = {}; - } - - const yamlLoaded = yaml.load(fileContents) ?? {}; - - return { - ...yamlLoaded, - isValid: fileContents !== "-\n" && stats.size !== 2 // see https://github.com/benphelps/homepage/pull/609 - }; + return yaml.load(fileContents) ?? {}; } \ No newline at end of file