Skip to content

Clean up IndexedDB previous-page listener#55

Open
issackjohn wants to merge 1 commit into
responsive-designfrom
fix-indexeddb-page-listener
Open

Clean up IndexedDB previous-page listener#55
issackjohn wants to merge 1 commit into
responsive-designfrom
fix-indexeddb-page-listener

Conversation

@issackjohn
Copy link
Copy Markdown
Owner

@issackjohn issackjohn commented Jun 1, 2026

Follow-up for local issue 52.

This replaces the hidden promiseResolve state stored on iterationFinishedListener with a local one-shot previous-page-loaded promise for each page transition.

The listener is now registered immediately before clicking the previous-page button, so the event cannot be missed, and it is automatically removed after firing.

Validation:

  • git diff --check

Note: local Node/npm tooling was not available in this shell, so browser CI should cover the end-to-end validation.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR cleans up the IndexedDB TodoMVC benchmark’s “previous page loaded” synchronization by replacing a shared, hidden promiseResolve function property with a per-transition one-shot promise tied to the previous-page-loaded event. This makes page-transition waiting deterministic (listener installed immediately before the click) and ensures the listener is automatically removed after firing.

Changes:

  • Replace the persistent previous-page-loaded listener + iterationFinishedListener.promiseResolve state with waitForPreviousPageLoaded() that uses addEventListener(..., { once: true }).
  • Register the listener immediately before clicking the previous-page button, then await the resulting promise.
  • Apply the same update to both the source and generated dist workload test files.

Reviewed changes

Copilot reviewed 1 out of 2 changed files in this pull request and generated no comments.

File Description
experimental/javascript-wc-indexeddb/src/workload-test.mjs Switches “previous page loaded” waiting logic to a per-iteration one-shot promise to avoid missed events and hidden listener state.
experimental/javascript-wc-indexeddb/dist/src/workload-test.mjs Keeps generated dist workload test in sync with the updated source behavior.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants