Build your personal knowledge base with Trilium Notes
TypeScript electronelectron-appknowledge-baseknowledge-graphknowledge-managementknowledge-management-graphlocal-firstnote-managmentnote-takernote-takingnotebooknotesnotes-apppersonal-knowledge-basepersonal-wikiscriptableself-hostedself-hostingwiki
fix(client/dialogs): branch prefix initial value incorrect
Elian Doranae46798d1d81
diff --git a/apps/client/src/widgets/dialogs/branch_prefix.tsx b/apps/client/src/widgets/dialogs/branch_prefix.tsxindex f042807486..46888f0ab4 100644--- a/apps/client/src/widgets/dialogs/branch_prefix.tsx+++ b/apps/client/src/widgets/dialogs/branch_prefix.tsx@@ -14,7 +14,7 @@ import FBranch from "../../entities/fbranch.js";export default function BranchPrefixDialog() {const [ shown, setShown ] = useState(false);const [ branch, setBranch ] = useState<FBranch>();- const [ prefix, setPrefix ] = useState(branch?.prefix ?? "");+ const [ prefix, setPrefix ] = useState("");const branchInput = useRef<HTMLInputElement>(null);useTriliumEvent("editBranchPrefix", async () => {@@ -32,13 +32,15 @@ export default function BranchPrefixDialog() {const newBranchId = await froca.getBranchId(parentNoteId, noteId);if (!newBranchId) {return;- }+ }const parentNote = await froca.getNote(parentNoteId);if (!parentNote || parentNote.type === "search") {return;}- setBranch(froca.getBranch(newBranchId));+ const newBranch = froca.getBranch(newBranchId);+ setBranch(newBranch);+ setPrefix(newBranch?.prefix ?? "");setShown(true);});@@ -77,4 +79,4 @@ export default function BranchPrefixDialog() {async function savePrefix(branchId: string, prefix: string) {await server.put(`branches/${branchId}/set-prefix`, { prefix: prefix });toast.showMessage(t("branch_prefix.branch_prefix_saved"));-}\ No newline at end of file+}