From 1d3c938def8359b69b8e491edc8817c856af7324 Mon Sep 17 00:00:00 2001 From: Stommer Date: Thu, 22 Oct 2026 13:39:52 +0200 Subject: [PATCH] =?UTF-8?q?Aktualisiere=20den=20Ablagebaum=20nach=20dem=20?= =?UTF-8?q?L=C3=B6sen=20eines=20Vorgangs=20aus=20einer=20Akte.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Sonnet 5.5 --- frontend/src/library/LibraryLayout.jsx | 12 ++++++++++++ frontend/src/pages/Matters.jsx | 11 +++++++---- 2 files changed, 19 insertions(+), 4 deletions(-) diff --git a/frontend/src/library/LibraryLayout.jsx b/frontend/src/library/LibraryLayout.jsx index 544528b..1993a92 100644 --- a/frontend/src/library/LibraryLayout.jsx +++ b/frontend/src/library/LibraryLayout.jsx @@ -80,6 +80,17 @@ export function LibraryLayout() { } }, [outlines]); + // After a change elsewhere (a matter detached): fetch the lists and every outline held in memory again. + const held = useRef(outlines); + held.current = outlines; + const refreshAll = useCallback(() => { + reload(); + for (const key of held.current.keys()) { + const [kind, id, contextId] = key.split(":"); + loadOutline(kind, id, contextId, true); + } + }, [reload, loadOutline]); + // The open entry changed (a chapter added, a matter moved): fetch its outline and the lists again. const stamp = focus?.stamp || ""; useEffect(() => { @@ -157,6 +168,7 @@ export function LibraryLayout() { const value = { ...data, reload, + refreshAll, notify, share, unshare, diff --git a/frontend/src/pages/Matters.jsx b/frontend/src/pages/Matters.jsx index 4a1d5a3..bdbdfcc 100644 --- a/frontend/src/pages/Matters.jsx +++ b/frontend/src/pages/Matters.jsx @@ -11,7 +11,7 @@ import { ChapterForm, FileForm, NoteForm } from "./Cases.jsx"; import { ContentBoard, DateField, ObjectMenu, Placements, SurfaceView, TargetLine, Trail, WorkLists, WorkSwitch, matterOpenHref, saveChapterOrder, writeChapter } from "./content.jsx"; import { ReadingPane } from "./ReadingPane.jsx"; import { Workspace, rememberScroll, restoreScroll, useWorkspaceLayout } from "./workspace.jsx"; -import { useLibraryFocus } from "../library/LibraryLayout.jsx"; +import { useLibrary, useLibraryFocus } from "../library/LibraryLayout.jsx"; import { outlineSignature } from "../library/library-core.js"; import { NavIcon } from "./icons.jsx"; import { ExportPackage } from "./ExportPackage.jsx"; @@ -41,6 +41,7 @@ function objectTrail(record, query) { export function MatterDetail() { const { id } = useParams(); const navigate = useNavigate(); + const library = useLibrary(); const [params, setParams] = useSearchParams(); const inherited = pageContext(params); const chapterId = params.get("kapitel") || ""; @@ -443,9 +444,11 @@ export function MatterDetail() { setModal("")}> Number(b.case_id === inherited?.id) - Number(a.case_id === inherited?.id))} + currentId={inherited?.kind === "case" ? inherited.id : ""} onDone={(link) => { setModal(""); + library?.refreshAll(); if (inherited?.kind === "case" && inherited.id === link.case_id) navigate(`/matters/${id}`, { replace: true }); else load(); }} @@ -465,7 +468,7 @@ export function MatterDetail() { } // Detaches the matter from one case. The matter itself and its content stay. -function UnlinkMatter({ title, links, onDone }) { +function UnlinkMatter({ title, links, currentId = "", onDone }) { const [error, setError] = useState(""); const [pending, setPending] = useState(""); @@ -487,7 +490,7 @@ function UnlinkMatter({ title, links, onDone }) { {links.map((link) => (
- Akte {link.title} + Akte {link.title}{link.case_id === currentId ? " (hier geöffnet)" : ""}