« get me outta code hell

hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/data/composite/wiki-data/withReverseContributionList.js
diff options
context:
space:
mode:
Diffstat (limited to 'src/data/composite/wiki-data/withReverseContributionList.js')
-rw-r--r--src/data/composite/wiki-data/withReverseContributionList.js12
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);