« get me outta code hell

data: Track: remove withAlbum, link album directly - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/things
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-04-06 15:34:13 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-04-10 16:02:39 -0300
commit67a936adc308a5bec6c969c90d8811fcbce3009b (patch)
tree17ce4121d50136ca6d54a666b20ab7dcb216cd94 /src/data/things
parent0c08c6225727b9bcc3113ec2604c84db9012faf2 (diff)
data: Track: remove withAlbum, link album directly
Diffstat (limited to 'src/data/things')
-rw-r--r--src/data/things/album.js2
-rw-r--r--src/data/things/track.js28
2 files changed, 6 insertions, 24 deletions
diff --git a/src/data/things/album.js b/src/data/things/album.js
index 606bc194..df19e817 100644
--- a/src/data/things/album.js
+++ b/src/data/things/album.js
@@ -646,7 +646,7 @@ export class Album extends Thing {
 
           artworkData.push(...entry.trackArtworks);
 
-          entry.dataSourceAlbum = albumRef;
+          entry.album = album;
         }
 
         closeCurrentTrackSection();
diff --git a/src/data/things/track.js b/src/data/things/track.js
index f514f7bb..457dca93 100644
--- a/src/data/things/track.js
+++ b/src/data/things/track.js
@@ -64,7 +64,6 @@ import {
   exitWithoutUniqueCoverArt,
   inheritContributionListFromMainRelease,
   inheritFromMainRelease,
-  withAlbum,
   withAllReleases,
   withAlwaysReferenceByDirectory,
   withContainingTrackSection,
@@ -124,6 +123,10 @@ export class Track extends Thing {
       })
     ],
 
+    album: thing({
+      class: input.value(Album),
+    }),
+
     additionalNames: additionalNameList(),
 
     bandcampTrackIdentifier: simpleString(),
@@ -226,14 +229,6 @@ export class Track extends Thing {
       find: soupyFind.input('track'),
     }),
 
-    // Internal use only - for directly identifying an album inside a track's
-    // util.inspect display, if it isn't indirectly available (by way of being
-    // included in an album's track list).
-    dataSourceAlbum: singleReference({
-      class: input.value(Album),
-      find: soupyFind.input('album'),
-    }),
-
     artistContribs: [
       inheritContributionListFromMainRelease(),
 
@@ -394,11 +389,6 @@ export class Track extends Thing {
 
     commentatorArtists: commentatorArtists(),
 
-    album: [
-      withAlbum(),
-      exposeDependency({dependency: '#album'}),
-    ],
-
     date: [
       withDate(),
       exposeDependency({dependency: '#date'}),
@@ -747,15 +737,7 @@ export class Track extends Thing {
     let album;
 
     if (depth >= 0) {
-      try {
-        album = this.album;
-      } catch (_error) {
-        // Computing album might crash for any reason, which we don't want to
-        // distract from another error we might be trying to work out at the
-        // moment (for which debugging might involve inspecting this track!).
-      }
-
-      album ??= this.dataSourceAlbum;
+      album = this.album;
     }
 
     if (album) {