diff options
Diffstat (limited to 'src/data/things.js')
-rw-r--r-- | src/data/things.js | 37 |
1 files changed, 22 insertions, 15 deletions
diff --git a/src/data/things.js b/src/data/things.js index 5aa43f30..c09f740c 100644 --- a/src/data/things.js +++ b/src/data/things.js @@ -671,21 +671,28 @@ Track.propertyDescriptors = { expose: { dependencies: ['originalReleaseTrackByRef', 'trackData'], - compute: ({ originalReleaseTrackByRef: ref1, trackData, [Track.instance]: t1 }) => ( - (ref1 && trackData - ? [ - find.track(ref1, {wikiData: {trackData}}), - ...trackData.filter(t2 => { - const { originalReleaseTrackByRef: ref2 } = t2; - return ( - t2 !== t1 && - ref2 && - ( - find.track(ref2, {wikiData: {trackData}}) === - find.track(ref1, {wikiData: {trackData}}))) - })] - : []) - ) + compute: ({ originalReleaseTrackByRef: ref1, trackData, [Track.instance]: t1 }) => { + if (!(ref1 && trackData)) { + return []; + } + + const tOrig = find.track(ref1, {wikiData: {trackData}}); + if (!tOrig) { + return []; + } + + return [ + tOrig, + ...trackData.filter(t2 => { + const { originalReleaseTrackByRef: ref2 } = t2; + return ( + t2 !== t1 && + ref2 && + find.track(ref2, {wikiData: {trackData}}) === tOrig + ); + }) + ]; + } } }, |