« 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.js30
1 files changed, 19 insertions, 11 deletions
diff --git a/src/data/things/track.js b/src/data/things/track.js
index 74f5d7fb..2a3148ef 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -344,28 +344,36 @@ export class Track extends Thing {
         },
       },
 
-      Track.composite.withAlbumProperties({
-        properties: ['trackCoverArtistContribs'],
-      }),
-
       Thing.composite.withResolvedContribs({
         from: 'coverArtistContribsByRef',
         to: '#coverArtistContribs',
       }),
 
       {
-        flags: {expose: true},
+        flags: {expose: true, compose: true},
         expose: {
-          dependencies: ['#coverArtistContribs', '#album.trackCoverArtistContribs'],
-          compute: ({
-            '#coverArtistContribs': contribsFromTrack,
-            '#album.trackCoverArtistContribs': contribsFromAlbum,
-          }) =>
+          mapDependencies: {contribsFromTrack: '#coverArtistContribs'},
+          compute: ({contribsFromTrack}, continuation) =>
             (empty(contribsFromTrack)
-              ? contribsFromAlbum
+              ? continuation()
               : contribsFromTrack),
         },
       },
+
+      Track.composite.withAlbumProperties({
+        properties: ['trackCoverArtistContribs'],
+      }),
+
+      {
+        flags: {expose: true},
+        expose: {
+          mapDependencies: {contribsFromAlbum: '#album.trackCoverArtistContribs'},
+          compute: ({contribsFromAlbum}) =>
+            (empty(contribsFromAlbum)
+              ? null
+              : contribsFromAlbum),
+        },
+      },
     ]),
 
     referencedTracks: Thing.composite.from(`Track.referencedTracks`, [