« get me outta code hell

data, test: TrackSection.tracks: use direct links - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2024-08-05 12:43:39 -0300
committer(quasar) nebula <qznebula@protonmail.com>2024-08-05 20:42:08 -0300
commit4362324b40da9daa54c9c6c3a821b0cccaec71a0 (patch)
treecc93f7222002d39b580fab3c1b01ca6e2ba39a22 /src
parent0dc4db58b90f46cc938b72d571d690e197c6c243 (diff)
data, test: TrackSection.tracks: use direct links
Diffstat (limited to 'src')
-rw-r--r--src/data/composite/things/track-section/withAlbum.js6
-rw-r--r--src/data/things/album.js19
-rw-r--r--src/data/yaml.js4
3 files changed, 8 insertions, 21 deletions
diff --git a/src/data/composite/things/track-section/withAlbum.js b/src/data/composite/things/track-section/withAlbum.js
index 608cc0cd..a4dfff0d 100644
--- a/src/data/composite/things/track-section/withAlbum.js
+++ b/src/data/composite/things/track-section/withAlbum.js
@@ -1,6 +1,4 @@
-// Gets the track section's album. This will early exit if ownAlbumData is
-// missing. If there's no album whose list of track sections includes this one,
-// the output dependency will be null.
+// Gets the track section's album.
 
 import {input, templateCompositeFrom} from '#composite';
 
@@ -13,7 +11,7 @@ export default templateCompositeFrom({
 
   steps: () => [
     withUniqueReferencingThing({
-      data: 'ownAlbumData',
+      data: 'albumData',
       list: input.value('trackSections'),
     }).outputs({
       ['#uniqueReferencingThing']: '#album',
diff --git a/src/data/things/album.js b/src/data/things/album.js
index f1a7df3d..82f155b4 100644
--- a/src/data/things/album.js
+++ b/src/data/things/album.js
@@ -440,15 +440,8 @@ export class Album extends Thing {
           }
 
           currentTrackSection.tracks =
-            currentTrackSectionTracks
-              .map(track => Thing.getReference(track));
-
-          currentTrackSection.ownTrackData =
             currentTrackSectionTracks;
 
-          currentTrackSection.ownAlbumData =
-            [album];
-
           trackSections.push(currentTrackSection);
           trackSectionData.push(currentTrackSection);
         };
@@ -521,22 +514,16 @@ export class TrackSection extends Thing {
       exposeDependency({dependency: '#album'}),
     ],
 
-    tracks: referenceList({
+    tracks: thingList({
       class: input.value(Track),
-      data: 'ownTrackData',
-      find: input.value(find.track),
     }),
 
     // Update only
 
-    ownAlbumData: wikiData({
+    albumData: wikiData({
       class: input.value(Album),
     }),
 
-    ownTrackData: wikiData({
-      class: input.value(Track),
-    }),
-
     // Expose only
 
     directory: [
@@ -655,8 +642,6 @@ export class TrackSection extends Thing {
         length = this.tracks.length;
       } catch {}
 
-      album ??= CacheableObject.getUpdateValue(this, 'ownAlbumData')?.[0];
-
       if (album) {
         const albumName = album.name;
         const albumIndex = album.trackSections.indexOf(this);
diff --git a/src/data/yaml.js b/src/data/yaml.js
index 7a16341b..ffa24669 100644
--- a/src/data/yaml.js
+++ b/src/data/yaml.js
@@ -1206,6 +1206,10 @@ export function linkWikiDataArrays(wikiData) {
       'wikiInfo',
     ]],
 
+    [wikiData.trackSectionData, [
+      'albumData',
+    ]],
+
     [[wikiData.wikiInfo], [
       'groupData',
     ]],