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.
This commit is contained in:
+4
-3
@@ -2046,6 +2046,7 @@ type TreeActionGroup = {
|
||||
|
||||
type TreeActionRunOptions = {
|
||||
clearSelection?: boolean;
|
||||
consumedKeys?: any[];
|
||||
};
|
||||
|
||||
const runActionWithPreview = async (
|
||||
@@ -2092,11 +2093,11 @@ const runActionWithPreview = async (
|
||||
await Swal.fire({
|
||||
title: treeText("success.title", "Handling udført"),
|
||||
icon: "success",
|
||||
timer: 1400,
|
||||
timer: 600,
|
||||
showConfirmButton: false,
|
||||
});
|
||||
if (activeSnapshot.value) {
|
||||
await refreshSnapshotAfterMutation();
|
||||
await refreshSnapshotAfterMutation({ consumedKeys: options.consumedKeys ?? [] });
|
||||
}
|
||||
emit("refresh");
|
||||
} catch (error: any) {
|
||||
@@ -2570,7 +2571,7 @@ const deleteOrderItems = (ids: any[] = orderItemIds(), options: TreeActionRunOpt
|
||||
}
|
||||
},
|
||||
true,
|
||||
options
|
||||
{ ...options, consumedKeys: ids.map((id) => makeNodeId(TREE_NODE_TYPES.ORDER_ITEM, id)) }
|
||||
);
|
||||
|
||||
const deleteSelectedOrderItems = () => deleteOrderItems(orderItemIds());
|
||||
|
||||
Reference in New Issue
Block a user