« get me outta code hell

data: withSourceText, withSourceURLs: fix providing undefined - 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-05-08 09:03:50 -0300
committer(quasar) nebula <qznebula@protonmail.com>2025-05-08 09:03:50 -0300
commitf21d6321916a76924a6e5cb66c240bff41d3481e (patch)
tree81920749748262e8a8cb63518babbbe723ea96b3
parent72f6fc9659fe4cc6ea60229e636421a78fe98f29 (diff)
data: withSourceText, withSourceURLs: fix providing undefined preview
-rw-r--r--src/data/composite/things/content/withSourceText.js3
-rw-r--r--src/data/composite/things/content/withSourceURLs.js3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/data/composite/things/content/withSourceText.js b/src/data/composite/things/content/withSourceText.js
index e0cd2f15..d310e8ea 100644
--- a/src/data/composite/things/content/withSourceText.js
+++ b/src/data/composite/things/content/withSourceText.js
@@ -28,7 +28,8 @@ export default templateCompositeFrom({
         ['#firstPartWithExternalLink']:
           annotationParts
             .find(nodes => nodes
-              .some(node => node.type === 'external-link')),
+              .some(node => node.type === 'external-link')) ??
+          null,
       }),
     },
 
diff --git a/src/data/composite/things/content/withSourceURLs.js b/src/data/composite/things/content/withSourceURLs.js
index 263eb5f6..f1e8dbc0 100644
--- a/src/data/composite/things/content/withSourceURLs.js
+++ b/src/data/composite/things/content/withSourceURLs.js
@@ -29,7 +29,8 @@ export default templateCompositeFrom({
         ['#firstPartWithExternalLink']:
           annotationParts
             .find(nodes => nodes
-              .some(node => node.type === 'external-link')),
+              .some(node => node.type === 'external-link')) ??
+          null,
       }),
     },