« get me outta code hell

data: withResolvedReferenceList: tolerate null data nicely - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/wiki-data
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-01-10 22:25:12 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-01-10 22:25:12 -0400
commita23d76cd720173b19e91a3777296f4299eecd5d2 (patch)
treeea79a98602b512973f0f03a97f1473e6cdaed258 /src/data/composite/wiki-data
parent35bcdcf40b33494042069a10617707fd0b4fca22 (diff)
data: withResolvedReferenceList: tolerate null data nicely
Diffstat (limited to 'src/data/composite/wiki-data')
-rw-r--r--src/data/composite/wiki-data/withResolvedReferenceList.js16
1 files changed, 6 insertions, 10 deletions
diff --git a/src/data/composite/wiki-data/withResolvedReferenceList.js b/src/data/composite/wiki-data/withResolvedReferenceList.js
index 0ac27ae3..d43a6ed9 100644
--- a/src/data/composite/wiki-data/withResolvedReferenceList.js
+++ b/src/data/composite/wiki-data/withResolvedReferenceList.js
@@ -1,8 +1,7 @@
 // Resolves a list of references, with each reference matched with provided
-// data in the same way as withResolvedReference. This will early exit if the
-// data dependency is null (even if the reference list is empty). By default
-// it will filter out references which don't match, but this can be changed
-// to early exit ({notFoundMode: 'exit'}) or leave null in place ('null').
+// data in the same way as withResolvedReference. By default it will filter
+// out references which don't match, but this can be changed to early exit
+// ({notFoundMode: 'exit'}) or leave null in place ('null').
 
 import {input, templateCompositeFrom} from '#composite';
 import {isString, validateArrayItems} from '#validators';
@@ -37,11 +36,6 @@ export default templateCompositeFrom({
   outputs: ['#resolvedReferenceList'],
 
   steps: () => [
-    exitWithoutDependency({
-      dependency: input('data'),
-      value: input.value([]),
-    }),
-
     raiseOutputWithoutDependency({
       dependency: input('list'),
       mode: input.value('empty'),
@@ -57,7 +51,9 @@ export default templateCompositeFrom({
         [input('find')]: findFunction,
       }) => continuation({
         ['#map']:
-          ref => findFunction(ref, data, {mode: 'quiet'}),
+          (data
+            ? ref => findFunction(ref, data, {mode: 'quiet'})
+            : ref => findFunction(ref, {mode: 'quiet'})),
       }),
     },