diff options
author | (quasar) nebula <qznebula@protonmail.com> | 2024-01-17 14:18:20 -0400 |
---|---|---|
committer | (quasar) nebula <qznebula@protonmail.com> | 2024-01-17 16:10:10 -0400 |
commit | c712bb783a2c213d036255f6468b0c06df8efc79 (patch) | |
tree | 9fd930423a978495e567aa1028612d893229a594 /src/data/composite/wiki-data/withReverseContributionList.js | |
parent | ebe2a4d41c55be1250d4964ab16b788f70d5943b (diff) |
data: withReverseReferenceList: mirror withReverseContributionList
Diffstat (limited to 'src/data/composite/wiki-data/withReverseContributionList.js')
-rw-r--r-- | src/data/composite/wiki-data/withReverseContributionList.js | 12 |
1 files changed, 8 insertions, 4 deletions
diff --git a/src/data/composite/wiki-data/withReverseContributionList.js b/src/data/composite/wiki-data/withReverseContributionList.js index 7b07e24a..eccb58b7 100644 --- a/src/data/composite/wiki-data/withReverseContributionList.js +++ b/src/data/composite/wiki-data/withReverseContributionList.js @@ -1,9 +1,9 @@ -// Analogous implementation for withReverseReferenceList, but contributions. +// Analogous implementation for withReverseReferenceList, for contributions. +// This is all duplicate code and both should be ported to the same underlying +// data form later on. // // This implementation uses a global cache (via WeakMap) to attempt to speed -// up subsequent similar accesses. Reverse contribution lists are the most -// costly in live-dev-server, but we intend to expand the impelemntation here -// to reverse reference lists in general later on. +// up subsequent similar accesses. // // This has absolutely not been rigorously tested with altering properties of // data objects in a wiki data array which is reused. If a new wiki data array @@ -57,6 +57,10 @@ export default templateCompositeFrom({ for (const referencingThing of data) { const referenceList = referencingThing[list]; + + // Destructuring {who} is the only unique part of the + // withReverseContributionList implementation, compared to + // withReverseReferneceList. for (const {who: referencedThing} of referenceList) { if (cacheRecord.has(referencedThing)) { cacheRecord.get(referencedThing).push(referencingThing); |