« get me outta code hell

data: isolate internals of dynamicThingsFromReferenceList - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2023-09-06 15:14:37 -0300
committer(quasar) nebula <qznebula@protonmail.com>2023-09-06 15:14:37 -0300
commit137bd813980d77441a86303ac6c04b61d9ccb8da (patch)
treed6594be15473b5b6011604293633b2ddbf62ebec /src/data/things
parent91624e5d61a1473e143bad8860c8c2ccffec38fe (diff)
data: isolate internals of dynamicThingsFromReferenceList
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/composite.js2
-rw-r--r--src/data/things/thing.js26
2 files changed, 11 insertions, 17 deletions
diff --git a/src/data/things/composite.js b/src/data/things/composite.js
index 4f1abdb4..e930e228 100644
--- a/src/data/things/composite.js
+++ b/src/data/things/composite.js
@@ -1207,7 +1207,7 @@ export function withResolvedReferenceList({
 
     raiseWithoutDependency(refList, {
       map: {to},
-      raise: [],
+      raise: {to: []},
       mode: 'empty',
     }),
 
diff --git a/src/data/things/thing.js b/src/data/things/thing.js
index 9bfed080..9f77c3fc 100644
--- a/src/data/things/thing.js
+++ b/src/data/things/thing.js
@@ -194,26 +194,20 @@ export default class Thing extends CacheableObject {
     // in the provided property and searches the specified wiki data for
     // matching actual Thing-subclass objects.
     dynamicThingsFromReferenceList(
-      refs,
+      refList,
       data,
       findFunction
     ) {
       return Thing.composite.from(`Thing.common.dynamicThingsFromReferenceList`, [
-        Thing.composite.earlyExitWithoutDependency(refs, {value: []}),
-        Thing.composite.earlyExitWithoutDependency(data, {value: []}),
-
-        {
-          flags: {expose: true},
-          expose: {
-            mapDependencies: {refs, data},
-            options: {findFunction},
-
-            compute: ({refs, data, '#options': {findFunction}}) =>
-              refs
-                .map(ref => findFunction(ref, data, {mode: 'quiet'}))
-                .filter(Boolean),
-          },
-        },
+        Thing.composite.withResolvedReferenceList({
+          refList,
+          data,
+          to: '#things',
+          find: findFunction,
+          notFoundMode: 'filter',
+        }),
+
+        Thing.composite.exposeDependency('#things'),
       ]);
     },