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;