From 048e79a1ea83a942579ce89f797795e34cc4199e Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sun, 19 May 2024 21:44:18 -0300 Subject: data: TrackSection thing objects Sorry this commit is kind of monolithic! It's difficult to separate out any of the changes since they're all related to track sections' basic functionality. --- src/data/composite/things/album/withTracks.js | 40 +++++++-------------------- 1 file changed, 10 insertions(+), 30 deletions(-) (limited to 'src/data/composite/things/album/withTracks.js') diff --git a/src/data/composite/things/album/withTracks.js b/src/data/composite/things/album/withTracks.js index fff3d5ae..05f5b24d 100644 --- a/src/data/composite/things/album/withTracks.js +++ b/src/data/composite/things/album/withTracks.js @@ -1,9 +1,8 @@ import {input, templateCompositeFrom} from '#composite'; -import find from '#find'; import {exitWithoutDependency, raiseOutputWithoutDependency} from '#composite/control-flow'; -import {withResolvedReferenceList} from '#composite/wiki-data'; +import {withFlattenedList, withPropertyFromList} from '#composite/data'; export default templateCompositeFrom({ annotation: `withTracks`, @@ -11,41 +10,22 @@ export default templateCompositeFrom({ outputs: ['#tracks'], steps: () => [ - exitWithoutDependency({ - dependency: 'ownTrackData', - value: input.value([]), - }), - raiseOutputWithoutDependency({ dependency: 'trackSections', - mode: input.value('empty'), output: input.value({ - ['#tracks']: [], + '#tracks': [], }), }), - { - dependencies: ['trackSections'], - compute: (continuation, {trackSections}) => - continuation({ - '#trackRefs': trackSections - .flatMap(section => section.tracks ?? []), - }), - }, - - withResolvedReferenceList({ - list: '#trackRefs', - data: 'ownTrackData', - find: input.value(find.track), + withPropertyFromList({ + list: 'trackSections', + property: input.value('tracks'), }), - { - dependencies: ['#resolvedReferenceList'], - compute: (continuation, { - ['#resolvedReferenceList']: resolvedReferenceList, - }) => continuation({ - ['#tracks']: resolvedReferenceList, - }) - }, + withFlattenedList({ + list: '#trackSections.tracks', + }).outputs({ + ['#flattenedList']: '#tracks', + }), ], }); -- cgit 1.3.0-6-gf8a5