From 8b8ff27b465108b068548f66f23f85c8190460ad Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Wed, 18 Nov 2026 12:14:16 +0800 Subject: [PATCH 1/2] fix(research): preserve saved case addresses when a version cannot open Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- ...esearch-evidence-version-browser-smoke.mjs | 77 ++++++++++++++++++- .../goal-research-analysis.tsx | 38 ++++++--- .../goal-research-history.tsx | 11 +-- .../research-case-study.tsx | 27 ++++--- docs/reference/trajectory-assessment.md | 4 + 5 files changed, 129 insertions(+), 28 deletions(-) diff --git a/apps/presentation/dashboard/smoke/research-evidence-version-browser-smoke.mjs b/apps/presentation/dashboard/smoke/research-evidence-version-browser-smoke.mjs index 69d8220693..d190526e97 100644 --- a/apps/presentation/dashboard/smoke/research-evidence-version-browser-smoke.mjs +++ b/apps/presentation/dashboard/smoke/research-evidence-version-browser-smoke.mjs @@ -103,14 +103,19 @@ try { localizedReady = false; const child = JSON.parse(await readFile(resolve(import.meta.dirname, "../src/data/fixtures/case-study-child.json"), "utf8")); const parent = {goal_id: child.parent_goal_id, display_name: "Benchmark", events: [], analyses: []}; + const recordsOnly = structuredClone(child.analyses[0]); + recordsOnly.title = "仅保留研究记录的版本"; + delete recordsOnly.case_study; const second = structuredClone(child.analyses[0]); second.title = "另一版解读"; + second.case_study.title = "修订版:误差与留存证据"; second.case_study.sections[1].citations[0].first_line = 2; - child.analyses.push(second); + child.analyses.push(recordsOnly, second); const study = await start("study", child, parent); const studyRead = await (await fetch(new URL(analysisPath + "?" + new URLSearchParams({goal_id: child.goal_id}), study))).json(); const studyPack = studyRead.pack; - const otherPack = studyRead.catalog.packs.find(pack => pack.pack_id !== studyPack.pack_id); + const otherPack = studyRead.catalog.packs.find(pack => pack.pack_id !== studyPack.pack_id && pack.case_study_summary); + const recordsPack = studyRead.catalog.packs.find(pack => !pack.case_study_summary); assert(otherPack, "Same Goal has two saved versions"); const chapter = studyPack.case_study.sections[1]; const address = new URL("/chat/", study); @@ -229,6 +234,74 @@ try { await page.goForward(); await page.waitForURL(url => url.searchParams.get("goalId") === parent.goal_id); assertParentAddress(); + + // A saved case address is never rewritten to a nearby version. Recover + // explicitly with the owner's version selector or default catalogue read. + const metrics = async () => (await fetch(new URL("/fixture/readback", study))).json(); + const beforeRecovery = await metrics(); + const caseHistoryReads = []; + const observeCaseHistory = request => { + const url = new URL(request.url()); + if (url.pathname === "/api/chat/explore-results" && url.searchParams.get("goal_id") === child.goal_id + && url.searchParams.get("view") === "history") caseHistoryReads.push(url.search); + }; + page.on("request", observeCaseHistory); + const versionWithoutStudy = new URL(address); + versionWithoutStudy.searchParams.set("research_pack", recordsPack.pack_id); + const versionOnly = new URL(versionWithoutStudy); + versionOnly.hash = ""; + await page.goto(versionOnly.href); + await page.getByText("此版本没有已保存的案例解读。", {exact: true}).waitFor({timeout: 6000}); + assert.equal(new URL(page.url()).searchParams.get("research_pack"), recordsPack.pack_id); + await page.goto(versionWithoutStudy.href); + await page.getByText("此版本没有已保存的案例解读。", {exact: true}).waitFor({timeout: 6000}); + assert.equal(new URL(page.url()).searchParams.get("research_pack"), recordsPack.pack_id); + assert.equal(new URL(page.url()).hash, address.hash); + assert.equal(await page.locator(".case-opening h2").count(), 0); + await page.getByRole("combobox", {name: "选择解读版本"}).selectOption(otherPack.pack_id); + await page.locator(".case-opening h2").waitFor(); + assert.equal(new URL(page.url()).searchParams.get("research_pack"), otherPack.pack_id); + assert.equal(await page.locator(".case-opening h2").textContent(), otherPack.case_study_summary.title); + await page.goBack(); + await page.getByText("此版本没有已保存的案例解读。", {exact: true}).waitFor(); + assert.equal(new URL(page.url()).hash, address.hash); + + await page.setViewportSize({width: 390, height: 900}); + const unavailable = new URL(bookmark); + unavailable.searchParams.set("research_pack", "f".repeat(64)); + await page.goto(unavailable.href); + await page.getByText("无法读取链接指定的解读。", {exact: true}).waitFor(); + const exactRetry = page.waitForResponse(response => { + const url = new URL(response.url()); + return url.pathname === analysisPath && url.searchParams.get("pack_id") === unavailable.searchParams.get("research_pack"); + }); + await page.getByRole("button", {name: "重试读取", exact: true}).press("Enter"); + assert.equal((await exactRetry).status(), 409); + assert.equal(new URL(page.url()).hash, unavailable.hash); + const browseSaved = page.getByRole("button", {name: "查看已保存的解读", exact: true}); + await browseSaved.press("Enter"); + await page.getByRole("heading", {name: studyPack.case_study.title, exact: true}).waitFor(); + assert.equal(await page.getByRole("combobox", {name: "选择解读版本"}).evaluate(el => el === document.activeElement), true); + assert.equal(new URL(page.url()).searchParams.get("goalId"), child.goal_id); + assert.equal(new URL(page.url()).hash, ""); + await page.goBack(); + await page.getByText("无法读取链接指定的解读。", {exact: true}).waitFor(); + assert.equal(new URL(page.url()).hash, unavailable.hash); + + const absentChapter = new URL(address); + absentChapter.hash = `case-section-${studyPack.pack_id}-absent`; + await page.goto(absentChapter.href); + await page.getByText("这条链接在所选解读中找不到章节。", {exact: false}).waitFor(); + assert.equal(new URL(page.url()).hash, absentChapter.hash); + await page.getByRole("navigation", {name: "解读目录"}).getByRole("link").nth(1).press("Enter"); + await atChapter(); + assert.equal(await page.getByText("这条链接在所选解读中找不到章节。", {exact: false}).count(), 0); + const afterRecovery = await metrics(); + page.off("request", observeCaseHistory); + assert.equal(afterRecovery.citation_reads, beforeRecovery.citation_reads); + assert.deepEqual(caseHistoryReads, [], "Explicit case links do not read the case's research history"); + assert.equal(afterRecovery.mutation_attempts, beforeRecovery.mutation_attempts); + assert.equal(afterRecovery.source_unchanged, true); console.log("research evidence version: study and history navigation, saved excerpts and chapter position restored"); } finally { releaseOriginal?.(); diff --git a/apps/presentation/dashboard/src/features/personal-workspace/goal-research-analysis.tsx b/apps/presentation/dashboard/src/features/personal-workspace/goal-research-analysis.tsx index 072a88d214..60c4689388 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/goal-research-analysis.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/goal-research-analysis.tsx @@ -314,7 +314,7 @@ export function useResearchAnalysis(goalId: string, active: boolean, zh: boolean requestAnimationFrame(() => {if (closedAt === citeGeneration.current) origin?.focus();}); }; return {readOnly: currentSnapshot?.execution_enabled === false || (Boolean(readSourceUrl) && currentSnapshot?.execution_enabled !== true), sourceScope, readUsageComparison, citation, citationBusy, citationError, sourcePanel, readCitation, readUsageTurn, retryCitation, closeCitation, onCitationLocationChange, goalId, zh, location, snapshot: currentSnapshot, pack: readingPack, requestPack: pack, savedOriginal, readError, error, loading, pending, cancelPending, recordedRunning, panel, trigger, read, show, execute, cancel, - studyNavigation, close: () => {invalidateCitation(); navigate(false); requestAnimationFrame(() => trigger.current?.focus());}, select: (id: string) => navigate(location.open, id, true)}; + studyNavigation, close: () => {invalidateCitation(); navigate(false); requestAnimationFrame(() => trigger.current?.focus());}, select: (id: string | null) => navigate(location.open, id, true)}; } type Controller = ReturnType; @@ -385,14 +385,18 @@ function AnalysisContinuation({pack: p, analysis: a}: {pack: Pack; analysis: Con ; } -function AnalysisReadState({analysis: a}: {analysis: Controller}) { +function AnalysisReadState({analysis: a, onBrowseStudies}: {analysis: Controller; onBrowseStudies?: () => void}) { const error = a.readError || a.snapshot?.originalReadError; if (error) return
{a.snapshot?.originalReadError && !a.readError ? {a.zh ? "已保存原文暂不可读,当前语言的分析状态仍保留。" : "The saved original could not be read. The current language’s analysis state is preserved."} : - {a.pack ? (a.zh ? "刷新失败,保留上次结果。" : "Refresh failed. Showing the last result.") + {onBrowseStudies ? (a.zh ? "无法读取链接指定的解读。" : "The linked study version could not be read.") + : a.pack ? (a.zh ? "刷新失败,保留上次结果。" : "Refresh failed. Showing the last result.") : (a.zh ? "暂时无法读取分析。" : "Analysis could not be read.")}} + {onBrowseStudies ? : null}

{error}

; if (!a.pack && a.loading && (!a.snapshot || a.snapshot.catalog.packs.length > 0)) return
@@ -419,24 +423,38 @@ export function ResearchReportSummary({analysis: a}: {analysis: Controller}) { } export function ResearchCaseReading({analysis: a, active}: {analysis: Controller; active: boolean}) { + const reader = useRef(null); + const focusAfterBrowse = useRef(false); const packs = (a.snapshot?.catalog.packs ?? []).filter(p => p.case_study_summary); const p = a.pack; const firstStudy = packs[0]?.pack_id; useEffect(() => { - const hash = window.location.hash; - if (!a.loading && !a.readError && p && !p.case_study && firstStudy - && !(hash.startsWith(caseChapterHashPrefix) && hash.includes("~"))) a.select(firstStudy); - }, [a.loading, a.readError, p?.pack_id, Boolean(p?.case_study), firstStudy]); - return
+ if (!a.loading && !a.readError && a.location.packId === null && p && !p.case_study && firstStudy + && !window.location.hash.startsWith(caseChapterHashPrefix)) a.select(firstStudy); + }, [a.loading, a.readError, a.location.packId, p?.pack_id, Boolean(p?.case_study), firstStudy]); + useLayoutEffect(() => { + if (!focusAfterBrowse.current || a.loading || (!p?.case_study && !a.readError)) return; + focusAfterBrowse.current = false; + if (document.activeElement === document.body) { + reader.current?.querySelector("select, h2, .analysis-read-error button")?.focus({preventScroll: true}); + } + }, [a.loading, a.readError, Boolean(p?.case_study)]); + const browseStudies = a.readError && !p && a.location.packId !== null ? () => { + focusAfterBrowse.current = true; + a.select(null); + } : undefined; + return
{packs.length > 1 || (packs.length === 1 && !p?.case_study) ?
: null} - + {p?.case_study ? : !a.loading && !a.readError ?

{a.zh ? "选择一份解读,阅读问题背景、策略差异、关键转折与证据。" : "Choose a study to read its background, approaches, turning points and evidence."}

: null} + onCitationLocationChange={a.onCitationLocationChange}/> : !a.loading && !a.readError && p ?

+ {a.zh ? "此版本没有已保存的案例解读。" : "This version has no saved case study."} +

: null}
; } diff --git a/apps/presentation/dashboard/src/features/personal-workspace/goal-research-history.tsx b/apps/presentation/dashboard/src/features/personal-workspace/goal-research-history.tsx index 3b2ff20e73..7bb83d289b 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/goal-research-history.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/goal-research-history.tsx @@ -68,10 +68,11 @@ export function GoalResearchHistory({goalId, originalGoalId = goalId, preferHist const requestedCase = caseMode.goalId === goalId ? caseMode.requested : null; const caseReading = requestedCase ?? !preferHistory; const hasCases = (analysis.snapshot?.catalog.packs ?? []).some(pack => pack.case_study_summary); - // Preserve the saved reading during catalogue loading or failure. A - // successful catalogue without a study falls back to the original history. + // A link to a particular version stays in the case reader even when that + // version has no study. An unpinned visit can fall back to ordinary history. const awaitingRequestedCase = requestedCase === true && (analysis.loading || Boolean(analysis.readError)); - const deferHistory = requestedCase === true && (hasCases || awaitingRequestedCase); + const caseViewAvailable = hasCases || awaitingRequestedCase || (requestedCase === true && analysis.location.packId !== null); + const deferHistory = requestedCase === true && caseViewAvailable; const historySource = JSON.stringify([goalId, originalGoalId, readSourceUrl]); const [openedHistorySource, setOpenedHistorySource] = useState(null); const readHistory = active && (!deferHistory || openedHistorySource === historySource); @@ -530,13 +531,13 @@ export function GoalResearchHistory({goalId, originalGoalId = goalId, preferHist : null; const emptyHistoryMessage = zh ? "这个 Goal 尚无研究历程" : "No research history for this Goal yet"; const selectedStrategy = hasNativeSource && !emptySourceHistory ? strategies.selection : null; - const readingCase = caseReading && (hasCases || awaitingRequestedCase) && (requestedCase === true || selectedStrategy === null); + const readingCase = caseReading && caseViewAvailable && (requestedCase === true || selectedStrategy === null); const alternateReading = readingCase ? : selectedStrategy !== null ? strategies.choose(null)}/> : null; return <> - {hasCases || awaitingRequestedCase ?
+ {caseViewAvailable ?
diff --git a/apps/presentation/dashboard/src/features/personal-workspace/research-case-study.tsx b/apps/presentation/dashboard/src/features/personal-workspace/research-case-study.tsx index 4487639894..7b12515b41 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/research-case-study.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/research-case-study.tsx @@ -64,7 +64,7 @@ export function ResearchCaseStudy({study, zh, historical, active, scope, navigat const article = useRef(null); const openCitation = useRef(onCitation); openCitation.current = onCitation; - const [missingCitation, setMissingCitation] = useState(false); + const [missingAnchor, setMissingAnchor] = useState(""); const {url, goalId, packId, namespace, follow} = navigation; const prefix = `${caseChapterHashPrefix.slice(1)}${namespace ? namespace + '-' : ''}${packId}-`; useEffect(() => { @@ -89,19 +89,22 @@ export function ResearchCaseStudy({study, zh, historical, active, scope, navigat const citation = match ? citations?.[Number(match[2]) - 1] : undefined; const origin = document.getElementById(hash.slice(1)); if (!citation || !origin || !article.current?.contains(origin)) { - setMissingCitation(true); + setMissingAnchor(hash); return; } - setMissingCitation(false); + setMissingAnchor(""); const disclosure = origin.closest('details'); if (disclosure) disclosure.open = true; openCitation.current(citation, origin, {hash, chapterHash: section ? `#${prefix}${section}` : ""}); return; } - setMissingCitation(false); - if (!scoped) return; - const chapter = document.getElementById(hash.slice(1)); - if (chapter && article.current?.contains(chapter) && chapter.getClientRects().length) focusChapter(chapter); + const chapter = scoped ? document.getElementById(hash.slice(1)) : null; + if (chapter && article.current?.contains(chapter) && chapter.getClientRects().length) { + setMissingAnchor(""); + focusChapter(chapter); + } else { + setMissingAnchor(hash.startsWith(caseChapterHashPrefix) ? hash : ""); + } }); }; restore(); @@ -121,7 +124,7 @@ export function ResearchCaseStudy({study, zh, historical, active, scope, navigat return
  • { if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) return; e.preventDefault(); - setMissingCitation(false); + setMissingAnchor(""); follow(href, true); onCitation(c, e.currentTarget, {hash: href.hash, chapterHash: section ? `#${prefix}${section}` : ""}); }}> @@ -132,11 +135,13 @@ export function ResearchCaseStudy({study, zh, historical, active, scope, navigat return

    {scope.case_id}

    -

    {study.title}

    +

    {study.title}

    {historical ?

    {zh ? '来源已变化或暂不可读。下文保留注册时的解读与证据快照,不能视作当前结果。' : 'The source changed or is unavailable. This reading and its evidence snapshot describe the registered version, not current results.'}

    : null} {study.language !== (zh ? 'zh' : 'en') ?

    {zh ? '显示已保存的英文原文。' : 'Showing the saved Chinese original.'}

    : null} - {missingCitation ?

    {zh ? '这条链接在所选解读中找不到原文。可从下方的依据入口选择。' : 'This link does not identify an original in the selected study. Choose a source below.'}

    : null} + {missingAnchor ?

    {missingAnchor.includes('~') + ? (zh ? '这条链接在所选解读中找不到原文。可从下方的依据入口选择。' : 'This link does not identify an original in the selected study. Choose a source below.') + : (zh ? '这条链接在所选解读中找不到章节。可从目录选择。' : 'This link does not identify a chapter in the selected study. Choose a chapter from the contents.')}

    : null}
    {zh ? '结论依据与范围' : 'Conclusion evidence and scope'} {citationLinks(study.citations)}

    {zh ? '已保存的作者分析;来源绑定不代表结论已独立验证。' : 'Saved author analysis; source binding does not independently verify the conclusions.'}

    @@ -152,7 +157,7 @@ export function ResearchCaseStudy({study, zh, historical, active, scope, navigat if (e.defaultPrevented || e.button !== 0 || e.metaKey || e.ctrlKey || e.altKey || e.shiftKey) return; e.preventDefault(); onCitationLocationChange(href.hash); - setMissingCitation(false); + setMissingAnchor(""); follow(href); const chapter = document.getElementById(id); if (chapter && article.current?.contains(chapter)) focusChapter(chapter); diff --git a/docs/reference/trajectory-assessment.md b/docs/reference/trajectory-assessment.md index 70068a275e..aa720f7286 100644 --- a/docs/reference/trajectory-assessment.md +++ b/docs/reference/trajectory-assessment.md @@ -44,6 +44,10 @@ switches show the saved original with a notice, without inventing a translation. Each citation in a case study has a direct link to that occurrence in its saved version. Opening it uses the same source reader as a citation selected on the page. Closing returns to the citation and restores its chapter address. +If a chapter is absent, the reader keeps the linked version and offers its +contents. If that version has no study, readers can choose another saved +version explicitly. If the link cannot be read, retry keeps the same address +and **Browse saved studies** opens the current Goal's saved readings. Rendering uses the existing Markdown renderer and host-owned components, with no executable HTML. Porthole is not a runtime dependency of this reader. From e7ae172ffb61496f19d46529d83a5c73c1db3f5f Mon Sep 17 00:00:00 2001 From: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> Date: Thu, 19 Nov 2026 02:18:39 +0800 Subject: [PATCH 2/2] Preserve citation focus after a saved study refresh Signed-off-by: LoopX Agent <337587101+loopx-agent@users.noreply.github.com> --- ...esearch-evidence-version-browser-smoke.mjs | 43 +++++++++++++++++++ .../research-case-study.tsx | 9 +++- 2 files changed, 50 insertions(+), 2 deletions(-) diff --git a/apps/presentation/dashboard/smoke/research-evidence-version-browser-smoke.mjs b/apps/presentation/dashboard/smoke/research-evidence-version-browser-smoke.mjs index d190526e97..61921dc2c8 100644 --- a/apps/presentation/dashboard/smoke/research-evidence-version-browser-smoke.mjs +++ b/apps/presentation/dashboard/smoke/research-evidence-version-browser-smoke.mjs @@ -235,6 +235,49 @@ try { await page.waitForURL(url => url.searchParams.get("goalId") === parent.goal_id); assertParentAddress(); + // Pinning the default study to its chapter address rereads the same version. + // Its late response must respect the focus returned by the evidence reader. + const defaultStudy = new URL(address); + defaultStudy.searchParams.delete("research_pack"); + defaultStudy.searchParams.delete("research_analysis_goal"); + defaultStudy.hash = ""; + await page.goto(defaultStudy.href); + await page.setViewportSize({width: 390, height: 900}); + await chapterControl.locator("summary").waitFor(); + const isSelectedVersionRead = url => url.origin === defaultStudy.origin && url.pathname === analysisPath + && url.searchParams.get("pack_id") === studyPack.pack_id; + const isLocalizedRead = url => isSelectedVersionRead(url) && url.searchParams.has("output_language"); + const stagedRead = Promise.withResolvers(); + await page.route(isLocalizedRead, async route => { + await stagedRead.promise; + return route.continue(); + }, {times: 1}); + try { + const selectedVersionRequest = page.waitForRequest(request => isLocalizedRead(new URL(request.url()))); + await page.getByRole("navigation", {name: "解读目录"}).getByRole("link").nth(1).press("Enter"); + await selectedVersionRequest; + await atChapter(); + await chapterControl.locator("summary").press("Enter"); + await originalLink.press("Enter"); + await citation.locator("pre").first().waitFor(); + await citation.press("Escape"); + await page.waitForFunction(id => document.activeElement?.id === id, bookmark.hash.slice(1)); + const savedOriginalRead = page.waitForResponse(response => { + const url = new URL(response.url()); + return response.ok() && isSelectedVersionRead(url) && !url.searchParams.has("output_language"); + }); + stagedRead.resolve(); + await (await savedOriginalRead).finished(); + await page.evaluate(() => new Promise(resolvePaint => requestAnimationFrame(() => requestAnimationFrame(resolvePaint)))); + assert.equal(await originalLink.evaluate(link => document.activeElement === link), true, + "A delayed reread of the selected version must leave focus on the citation after closing it"); + assert.equal(new URL(page.url()).hash, address.hash); + } finally { + stagedRead.resolve(); + await page.unroute(isLocalizedRead); + } + await page.setViewportSize({width: 1200, height: 900}); + // A saved case address is never rewritten to a nearby version. Recover // explicitly with the owner's version selector or default catalogue read. const metrics = async () => (await fetch(new URL("/fixture/readback", study))).json(); diff --git a/apps/presentation/dashboard/src/features/personal-workspace/research-case-study.tsx b/apps/presentation/dashboard/src/features/personal-workspace/research-case-study.tsx index 7b12515b41..35ab8f6e18 100644 --- a/apps/presentation/dashboard/src/features/personal-workspace/research-case-study.tsx +++ b/apps/presentation/dashboard/src/features/personal-workspace/research-case-study.tsx @@ -62,11 +62,15 @@ export function ResearchCaseStudy({study, zh, historical, active, scope, navigat onCitationLocationChange: (hash: string) => void; }) { const article = useRef(null); + const currentStudy = useRef(study); + currentStudy.current = study; const openCitation = useRef(onCitation); openCitation.current = onCitation; const [missingAnchor, setMissingAnchor] = useState(""); const {url, goalId, packId, namespace, follow} = navigation; const prefix = `${caseChapterHashPrefix.slice(1)}${namespace ? namespace + '-' : ''}${packId}-`; + // A reread can replace the study object while the saved version and address + // stay the same. Only navigation should run chapter and citation restoration. useEffect(() => { if (!active) return; let frame = 0; @@ -85,7 +89,8 @@ export function ResearchCaseStudy({study, zh, historical, active, scope, navigat // into a source identifier or range for the evidence API. const match = scoped ? /^([a-zA-Z0-9_-]*)~([1-9][0-9]?)$/.exec(hash.slice(prefix.length + 1)) : null; const section = match?.[1]; - const citations = section ? study.sections.find(item => item.id === section)?.citations : study.citations; + const savedStudy = currentStudy.current; + const citations = section ? savedStudy.sections.find(item => item.id === section)?.citations : savedStudy.citations; const citation = match ? citations?.[Number(match[2]) - 1] : undefined; const origin = document.getElementById(hash.slice(1)); if (!citation || !origin || !article.current?.contains(origin)) { @@ -115,7 +120,7 @@ export function ResearchCaseStudy({study, zh, historical, active, scope, navigat window.removeEventListener('popstate', restore); window.removeEventListener('hashchange', restore); }; - }, [active, goalId, packId, prefix, study, onCitationLocationChange]); + }, [active, goalId, packId, prefix, onCitationLocationChange]); const citationLinks = (citations: AssessmentCitation[], section = "") =>
      {citations.map((c, i) => { const id = `${prefix}${section}~${i + 1}`;