Clean up IndexedDB previous-page listener#55
Open
issackjohn wants to merge 1 commit into
Open
Conversation
There was a problem hiding this comment.
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-loadedlistener +iterationFinishedListener.promiseResolvestate withwaitForPreviousPageLoaded()that usesaddEventListener(..., { once: true }). - Register the listener immediately before clicking the previous-page button, then
awaitthe resulting promise. - Apply the same update to both the source and generated
distworkload 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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
iterationFinishedListenerwith a per-navigation promise.previous-page-loadedlistener before clicking the Previous button, then await that page transition.distworkload in sync with the source.Why
The previous implementation kept mutable resolver state on a function object and registered a listener that was never removed. Scoping each listener to one page transition makes the control flow explicit and cleans it up automatically after the event fires.
Validation
git diff --checkCloses #52.