Aktualisiere den Ablagebaum nach dem Lösen eines Vorgangs aus einer Akte.
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
07e46c77f1
commit
1d3c938def
2 files changed
+19
-4
No files matched your search
@@ -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,
|
||||
|
||||
@@ -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() {
|
||||
<Modal open={modal === "unlink"} title="Aus Akte lösen" onClose={() => setModal("")}>
|
||||
<UnlinkMatter
|
||||
title={record.title}
|
||||
links={record.case_links || []}
|
||||
links={[...(record.case_links || [])].sort((a, b) => 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 }) {
|
||||
<ErrorNote error={error} />
|
||||
{links.map((link) => (
|
||||
<div key={link.id} className="inline-actions">
|
||||
<span>Akte {link.title}</span>
|
||||
<span>Akte {link.title}{link.case_id === currentId ? " (hier geöffnet)" : ""}</span>
|
||||
<button type="button" className="quiet" disabled={Boolean(pending)} onClick={() => unlink(link)}>
|
||||
{pending === link.id ? "Wird gelöst …" : "Aus dieser Akte lösen"}
|
||||
</button>
|
||||
|
||||
Reference in new issue
Block a user