« get me outta code hell

infra: tweak how empty content function modules are handled - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-10-08 12:43:00 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-10-08 12:43:26 -0300
commit822d0ad890cbdb2a780a2fdf7d1c1aa053fc1d77 (patch)
treea479c4ab1cccb0d64bfc94963501bc3d0b84ae5c
parent680cc3acdcabfe8d765275a7f78c4b254670fe2e (diff)
infra: tweak how empty content function modules are handled
-rw-r--r--src/content/dependencies/index.js9
1 files changed, 8 insertions, 1 deletions
diff --git a/src/content/dependencies/index.js b/src/content/dependencies/index.js
index 7180205..58bac0d 100644
--- a/src/content/dependencies/index.js
+++ b/src/content/dependencies/index.js
@@ -177,7 +177,14 @@ export function watchContentDependencies({
       // Just skip newly created files. They'll be processed again when
       // written.
       if (spec === undefined) {
-        contentDependencies[functionName] = null;
+        // For practical purposes the file is treated as though it doesn't
+        // even exist (undefined), rather than not being ready yet (null).
+        // Apart from if existing contents of the file were erased (but not
+        // the file itself), this value might already be set (to null!) by
+        // the readdir performed at the beginning to evaluate which files
+        // should be read and processed at least once before reporting all
+        // dependencies as ready.
+        delete contentDependencies[functionName];
         return;
       }