From 78137fb3dde2aa63a0aba6ff85956b0566fcb17b Mon Sep 17 00:00:00 2001 From: salmonumbrella <182032677+salmonumbrella@users.noreply.github.com> Date: Fri, 19 Jun 2026 02:29:58 -0700 Subject: [PATCH] Fix multi-value attribute cells rendering with page-ref brackets extractTag only unwraps a single whole-string tag, so multi-value attributes kept their [[ ]] while single values did not. Add an opt-in stripRefs flag to toCellValue, set only at the results-table display site, leaving raw-value callers (filters, kanban, in-place edits) unchanged. --- src/components/ResultsTable.tsx | 1 + src/utils/toCellValue.ts | 13 ++++++++++++- 2 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/components/ResultsTable.tsx b/src/components/ResultsTable.tsx index 2136092a..ac1ed47a 100644 --- a/src/components/ResultsTable.tsx +++ b/src/components/ResultsTable.tsx @@ -190,6 +190,7 @@ const ResultRow = ({ const value = toCellValue({ value: r[`${key}-display`] || r[key] || "", uid: (r[`${key}-uid`] as string) || "", + stripRefs: true, }); const action = r[`${key}-action`]; if (typeof action === "string") { diff --git a/src/utils/toCellValue.ts b/src/utils/toCellValue.ts index 81022f70..63c0a2f9 100644 --- a/src/utils/toCellValue.ts +++ b/src/utils/toCellValue.ts @@ -38,10 +38,12 @@ const toCellValue = ({ value, uid, defaultValue = "", + stripRefs = false, }: { value: number | Date | string; defaultValue?: string; uid: string; + stripRefs?: boolean; }) => { const initialValue = value instanceof Date @@ -62,7 +64,16 @@ const toCellValue = ({ .join("/") : initialValue : initialValue; - return formattedValue; + + // `extractTag` only unwraps a single, whole-string tag, so a multi-value + // attribute (e.g. `[[A]], [[B]]`) keeps its `[[ ]]` while a single value is + // unwrapped. When rendering for display, strip the page-ref delimiters from + // every remaining ref so multi-value cells read the same as single-value + // ones. Off by default so callers relying on the raw value (filtering, + // in-place edits) are unaffected. + return stripRefs + ? formattedValue.replace(/#?\[\[([^[\]]+)\]\]/g, "$1") + : formattedValue; }; export default toCellValue;