fix: preserve newer tender note drafts after delayed saves

This commit is contained in:
2026-09-06 09:07:23 +03:00
parent d4d9d17a9f
commit 7ad5fb4f50
4 changed files with 59 additions and 19 deletions
+12
View File
@@ -0,0 +1,12 @@
// Draft objects identify the exact edit submitted; equal text can still be a new edit.
export function editNoteDraft(state, owner, key, text) {
if (state.owner !== owner) return state;
return { ...state, drafts: { ...state.drafts, [key]: { text } } };
}
export function acknowledgeNoteDraft(state, owner, key, submitted) {
if (state.owner !== owner || !submitted || state.drafts[key] !== submitted) return state;
const drafts = { ...state.drafts };
delete drafts[key];
return { ...state, drafts };
}