From 9d99dafca9dc4e16b867b707746314040a8d9ba5 Mon Sep 17 00:00:00 2001 From: "(quasar) nebula" Date: Sat, 11 Jan 2025 00:11:37 -0400 Subject: data: use soupyFind everywhere also notes where remaining directly-provided wikiData() props are used --- src/data/yaml.js | 32 +++++++++----------------------- 1 file changed, 9 insertions(+), 23 deletions(-) (limited to 'src/data/yaml.js') diff --git a/src/data/yaml.js b/src/data/yaml.js index 2420bf71..cb16f872 100644 --- a/src/data/yaml.js +++ b/src/data/yaml.js @@ -1227,11 +1227,11 @@ export async function loadAndProcessDataDocuments(dataSteps, {dataPath}) { // of which are required for page HTML generation and other expected behavior). export function linkWikiDataArrays(wikiData, {bindFind}) { const linkWikiDataSpec = new Map([ + // entries must be present here even without any properties to explicitly + // link if the 'find' property will be implicitly linked + [wikiData.albumData, [ 'albumData', - 'artTagData', - 'artistData', - 'groupData', 'trackData', 'wikiInfo', ]], @@ -1243,47 +1243,33 @@ export function linkWikiDataArrays(wikiData, {bindFind}) { [wikiData.artistData, [ 'albumData', - 'artistData', 'flashData', 'groupData', 'trackData', ]], [wikiData.flashData, [ - 'artistData', 'flashActData', - 'trackData', 'wikiInfo', ]], [wikiData.flashActData, [ - 'flashData', 'flashSideData', ]], - [wikiData.flashSideData, [ - 'flashActData', - ]], + [wikiData.flashSideData, [/* find */]], [wikiData.groupData, [ 'albumData', - 'artistData', 'groupCategoryData', ]], - [wikiData.groupCategoryData, [ - 'groupData', - ]], + [wikiData.groupCategoryData, [/* find */]], - [wikiData.homepageLayout?.rows, [ - 'albumData', - 'groupData', - ]], + [wikiData.homepageLayout.rows, [/* find */]], [wikiData.trackData, [ 'albumData', - 'artTagData', - 'artistData', 'flashData', 'trackData', 'trackSectionData', @@ -1294,14 +1280,14 @@ export function linkWikiDataArrays(wikiData, {bindFind}) { 'albumData', ]], - [[wikiData.wikiInfo], [ - 'groupData', - ]], + [[wikiData.wikiInfo], [/* find */]], ]); const constructorHasFindMap = new Map(); const boundFind = bindFind(wikiData); + for (const thing of Object.values(wikiData).flat()); + for (const [things, keys] of linkWikiDataSpec.entries()) { if (things === undefined) continue; -- cgit 1.3.0-6-gf8a5