From dfc5b7e452c59fb9255681f6dbd54adec429a052 Mon Sep 17 00:00:00 2001 From: Issack John <117320405+issackjohn@users.noreply.github.com> Date: Mon, 1 Jun 2026 16:37:18 -0700 Subject: [PATCH] Document IndexedDB delete/read sync boundary --- .../javascript-wc-indexeddb/dist/src/workload-test.mjs | 8 +++++++- .../javascript-wc-indexeddb/src/workload-test.mjs | 8 +++++++- 2 files changed, 14 insertions(+), 2 deletions(-) diff --git a/experimental/javascript-wc-indexeddb/dist/src/workload-test.mjs b/experimental/javascript-wc-indexeddb/dist/src/workload-test.mjs index 47f5a3364..ee8b01ef8 100644 --- a/experimental/javascript-wc-indexeddb/dist/src/workload-test.mjs +++ b/experimental/javascript-wc-indexeddb/dist/src/workload-test.mjs @@ -79,7 +79,13 @@ const suites = { const item = items[i].shadowRoot.querySelector(".remove-todo-button"); item.click(); } - if (j < 9) { + if (j < numberOfIterations - 1) { + // moveToPreviousPage() dispatches previous-page-loaded only + // after the storage read for the previous page completes. + // The read fetches lower item numbers than the page just + // deleted, so it does not race those pending delete writes. + // FinishDeletingItemsFromDB still waits for all deletes + // before the suite advances. const previousPageButton = document.querySelector("todo-app").shadowRoot.querySelector("todo-bottombar").shadowRoot.querySelector(".previous-page-button"); previousPageButton.click(); await iterationFinishedPromise; diff --git a/experimental/javascript-wc-indexeddb/src/workload-test.mjs b/experimental/javascript-wc-indexeddb/src/workload-test.mjs index 66784deec..5bb3a2888 100644 --- a/experimental/javascript-wc-indexeddb/src/workload-test.mjs +++ b/experimental/javascript-wc-indexeddb/src/workload-test.mjs @@ -79,7 +79,13 @@ const suites = { const item = items[i].shadowRoot.querySelector(".remove-todo-button"); item.click(); } - if (j < 9) { + if (j < numberOfIterations - 1) { + // moveToPreviousPage() dispatches previous-page-loaded only + // after the storage read for the previous page completes. + // The read fetches lower item numbers than the page just + // deleted, so it does not race those pending delete writes. + // FinishDeletingItemsFromDB still waits for all deletes + // before the suite advances. const previousPageButton = document.querySelector("todo-app").shadowRoot.querySelector("todo-bottombar").shadowRoot.querySelector(".previous-page-button"); previousPageButton.click(); await iterationFinishedPromise;