« get me outta code hell

data: Contribution: dateless prev/next stays in album bounds - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-03-22 15:30:49 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-03-22 15:30:49 -0300
commit0ee5fb62a6c67548fccd4fc497e28cb03bcee06e (patch)
tree1a27a408702322aa7678e570530f3a34fa3b0ae6
parent152d706bb3d7a6a03e0dd0d74e7de6bfe5982b59 (diff)
data: Contribution: dateless prev/next stays in album bounds
-rw-r--r--src/data/composite/things/contribution/withContainingReverseContributionList.js26
1 files changed, 23 insertions, 3 deletions
diff --git a/src/data/composite/things/contribution/withContainingReverseContributionList.js b/src/data/composite/things/contribution/withContainingReverseContributionList.js
index dc990ca5..175d6cbb 100644
--- a/src/data/composite/things/contribution/withContainingReverseContributionList.js
+++ b/src/data/composite/things/contribution/withContainingReverseContributionList.js
@@ -1,6 +1,7 @@
 // Get the artist's contribution list containing this property. Although that
-// list literally includes both dated and un-dated contributions, here the list
-// is filtered including only the matching subset (has dates vs dateless).
+// list literally includes both dated and dateless contributions, here, if the
+// current contribution is dateless, the list is filtered to only include
+// dateless contributions from the same immediately nearby context.
 
 import {input, templateCompositeFrom} from '#composite';
 
@@ -51,9 +52,28 @@ export default templateCompositeFrom({
       compute: (continuation, {
         ['#hasDate']: hasDate,
         ['#list']: list,
+      }) =>
+        (hasDate
+          ? continuation.raiseOutput({
+              ['#containingReverseContributionList']:
+                list.filter(contrib => contrib.date),
+            })
+          : continuation({
+              ['#list']:
+                list.filter(contrib => !contrib.date),
+            })),
+    },
+
+    {
+      dependencies: ['#list', 'thing'],
+      compute: (continuation, {
+        ['#list']: list,
+        ['thing']: thing,
       }) => continuation({
         ['#containingReverseContributionList']:
-          list.filter(contribution => !!contribution.date === hasDate),
+          (thing.album
+            ? list.filter(contrib => contrib.thing.album === thing.album)
+            : list),
       }),
     },
   ],