diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2023-09-08 11:32:50 -0300 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2023-09-08 11:32:50 -0300 |
commit | bf0be010c9d9b860ad42762fc2e373130c7535eb (patch) | |
tree | 94c3f8b8d38c4ee2ae8d3dea6ce5e465e3a13ca7 | |
parent | f82c43f594ee5eadde34c05d45b9ce7a14301a87 (diff) |
data: update Album.tracks
-rw-r--r-- | src/data/things/album.js | 33 |
1 files changed, 22 insertions, 11 deletions
diff --git a/src/data/things/album.js b/src/data/things/album.js index 3726a463..76e0f638 100644 --- a/src/data/things/album.js +++ b/src/data/things/album.js @@ -26,6 +26,7 @@ import Thing, { urls, wikiData, withResolvedContribs, + withResolvedReferenceList, } from './thing.js'; export class Album extends Thing { @@ -147,20 +148,30 @@ export class Album extends Thing { hasWallpaperArt: contribsPresent('wallpaperArtistContribs'), hasBannerArt: contribsPresent('bannerArtistContribs'), - tracks: { - flags: {expose: true}, + tracks: compositeFrom(`Album.tracks`, [ + exitWithoutDependency({ + dependency: 'trackSections', + mode: 'empty', + value: [], + }), - expose: { + { dependencies: ['trackSections', 'trackData'], - compute: ({trackSections, trackData}) => - (trackSections && trackData - ? trackSections - .flatMap(section => section.tracks ?? []) - .map(ref => find.track(ref, trackData, {mode: 'quiet'})) - .filter(Boolean) - : []), + compute: ({trackSections, trackData}, continuation) => + continuation({ + '#trackRefs': trackSections + .flatMap(section => section.tracks ?? []), + }), }, - }, + + withResolvedReferenceList({ + list: '#trackRefs', + data: 'trackData', + find: find.track, + }), + + exposeDependency({dependency: '#resolvedReferenceList'}), + ]), }); static [Thing.getSerializeDescriptors] = ({ |