From 907e3ccec90e8e36e543a3de62de27cb6a6a5434 Mon Sep 17 00:00:00 2001 From: Tomas Balsys Date: Fri, 12 Dec 2025 04:42:34 +0200 Subject: [PATCH] Protect changing in parallel using HTTP 412 precondition failed --- ui/src/components/records/RecordUpsertPanel.svelte | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/ui/src/components/records/RecordUpsertPanel.svelte b/ui/src/components/records/RecordUpsertPanel.svelte index 7bc9a992..15985d63 100644 --- a/ui/src/components/records/RecordUpsertPanel.svelte +++ b/ui/src/components/records/RecordUpsertPanel.svelte @@ -278,7 +278,11 @@ if (isNew) { result = await ApiClient.collection(collection.id).create(data); } else { - result = await ApiClient.collection(collection.id).update(record.id, data); + result = await ApiClient.collection(collection.id).update(record.id, data, { + headers: { + "If-Unmodified-Since": record.updated, + }, + }); } addSuccessToast(isNew ? "Successfully created record." : "Successfully updated record."); @@ -318,7 +322,11 @@ confirm(`Do you really want to delete the selected record?`, () => { return ApiClient.collection(original.collectionId) - .delete(original.id) + .delete(original.id, { + headers: { + "If-Unmodified-Since": record.updated, + }, + }) .then(() => { forceHide(); addSuccessToast("Successfully deleted record.");