« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data
diff options
context:
space:
mode:
Diffstat (limited to 'src/data')
-rw-r--r--src/data/things/track.js25
1 files changed, 17 insertions, 8 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 5c3a1d46..016f5199 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -303,25 +303,34 @@ export class Track extends Thing {
     artistContribs: Thing.composite.from(`Track.artistContribs`, [
       Track.composite.inheritFromOriginalRelease({property: 'artistContribs'}),
 
-      Track.composite.withAlbumProperties({properties: ['artistContribs']}),
       Thing.composite.withResolvedContribs({
         from: 'artistContribsByRef',
         to: '#artistContribs',
       }),
 
       {
-        flags: {expose: true},
+        flags: {expose: true, compose: true},
         expose: {
-          dependencies: ['#artistContribs', '#album.artistContribs'],
-          compute: ({
-            '#artistContribs': contribsFromTrack,
-            '#album.artistContribs': contribsFromAlbum,
-          }) =>
+          mapDependencies: {contribsFromTrack: '#artistContribs'},
+          compute: ({contribsFromTrack}, continuation) =>
             (empty(contribsFromTrack)
-              ? contribsFromAlbum
+              ? continuation()
               : contribsFromTrack),
         },
       },
+
+      Track.composite.withAlbumProperties({properties: ['artistContribs']}),
+
+      {
+        flags: {expose: true},
+        expose: {
+          mapDependencies: {contribsFromAlbum: '#album.artistContribs'},
+          compute: ({contribsFromAlbum}) =>
+            (empty(contribsFromAlbum)
+              ? null
+              : contribsFromAlbum),
+        },
+      },
     ]),
 
     contributorContribs: Thing.composite.from(`Track.contributorContribs`, [