Compare commits

...
Author SHA1 Message Date
Jeppe B bda0c7d87c fix(pleno-vue): keep card expanded and shorten success modal after delete
Bug #12 (Sarah #10714): Deleting an invoice line collapsed the open
invoice card and the line did not visually disappear until F5.

Two related root causes addressed:

1. consumedKeys were never passed through the tree action runner, so
   refreshSnapshotAfterMutation filtered the previously-expanded keys
   against the post-delete snapshot but kept the deleted item id in
   checkedKeys and re-emitted an empty update to the BuefyTree. The
   TreeActionRunOptions now accepts consumedKeys; deleteOrderItems
   threads the deleted item node-ids through, and runActionWithPreview
   forwards them to refreshSnapshotAfterMutation so the snapshot
   refresh re-anchors tree state on the still-valid parent ids.

2. The success SweetAlert had timer: 1400ms which left a visible modal
   covering the card during the actual snapshot reload. Operators
   reading the screen interpreted the card's continued collapsed state
   as the delete not having taken effect. Reducing the timer to 600ms
   shrinks the perceptual gap between the modal closing and the
   refreshed snapshot becoming visible.
2026-08-10 20:13:30 +02:00
@@ -2046,6 +2046,7 @@ type TreeActionGroup = {
type TreeActionRunOptions = { type TreeActionRunOptions = {
clearSelection?: boolean; clearSelection?: boolean;
consumedKeys?: any[];
}; };
const runActionWithPreview = async ( const runActionWithPreview = async (
@@ -2092,11 +2093,11 @@ const runActionWithPreview = async (
await Swal.fire({ await Swal.fire({
title: treeText("success.title", "Handling udført"), title: treeText("success.title", "Handling udført"),
icon: "success", icon: "success",
timer: 1400, timer: 600,
showConfirmButton: false, showConfirmButton: false,
}); });
if (activeSnapshot.value) { if (activeSnapshot.value) {
await refreshSnapshotAfterMutation(); await refreshSnapshotAfterMutation({ consumedKeys: options.consumedKeys ?? [] });
} }
emit("refresh"); emit("refresh");
} catch (error: any) { } catch (error: any) {
@@ -2570,7 +2571,7 @@ const deleteOrderItems = (ids: any[] = orderItemIds(), options: TreeActionRunOpt
} }
}, },
true, true,
options { ...options, consumedKeys: ids.map((id) => makeNodeId(TREE_NODE_TYPES.ORDER_ITEM, id)) }
); );
const deleteSelectedOrderItems = () => deleteOrderItems(orderItemIds()); const deleteSelectedOrderItems = () => deleteOrderItems(orderItemIds());