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
client/note type conversion: fix an issue
Adorian Doran50ce5918262f
diff --git a/apps/client/src/widgets/bulk_actions/note/convert_note.tsx b/apps/client/src/widgets/bulk_actions/note/convert_note.tsxindex 42c410a4b6..3eefc62a66 100644--- a/apps/client/src/widgets/bulk_actions/note/convert_note.tsx+++ b/apps/client/src/widgets/bulk_actions/note/convert_note.tsx@@ -15,10 +15,12 @@ function ConvertNoteBulkActionComponent({ bulkAction, actionDef }: { bulkAction:...NOTE_CONVERSION_IDS.map((value) => ({ value, title: t(`convert_note.conversion_${value}`) }))];- // Persist the choice immediately (not debounced) so executing right after selecting doesn't- // run against a stale/empty conversion and silently skip every note.+ // Update the in-memory action immediately (not debounced) so the confirmation prompt and the+ // executed payload both use the live choice, without waiting for the async label save to+ // round-trip through the server.function onChange(value: string) {setConversion(value);+ bulkAction.actionDef.conversion = value;void bulkAction.saveAction({ conversion: value });}diff --git a/apps/client/src/widgets/dialogs/bulk_actions.tsx b/apps/client/src/widgets/dialogs/bulk_actions.tsxindex 785619b09e..55700613b6 100644--- a/apps/client/src/widgets/dialogs/bulk_actions.tsx+++ b/apps/client/src/widgets/dialogs/bulk_actions.tsx@@ -69,9 +69,18 @@ export default function BulkActionsDialog() {return;}+ // Submit the in-memory action definitions rather than letting the server re-read the+ // stored labels, so a still-in-flight action save can't make the batch run against a+ // stale/empty choice.+ const actions = existingActions.map((action) => ({+ ...action.actionDef,+ name: (action.constructor as typeof AbstractBulkAction).actionName+ }));+await server.post("bulk-action/execute", {noteIds: selectedOrActiveNoteIds,- includeDescendants+ includeDescendants,+ actions});toast.showMessage(t("bulk_actions.bulk_actions_executed"), 3000);