[Website] Share concurrent OPFS autosave operations - #4140
Merged
Conversation
Base automatically changed from
adamziel/serialize-opfs-metadata-writes
to
trunk
July 21, 2026 11:06
adamziel
force-pushed
the
adamziel/serialize-opfs-autosaves
branch
from
July 21, 2026 11:06
fe6c6a3 to
552163d
Compare
Contributor
There was a problem hiding this comment.
Pull request overview
Note
Copilot was unable to run its full agentic suite in this review.
Shares a single in-flight OPFS autosave operation across concurrent callers for the same temporary Playground, preventing duplicate persistence pipelines and consolidating routing/pruning behavior.
Changes:
- Add per-store (per-dispatch) tracking of in-flight autosaves and reuse the same promise for concurrent callers.
- Consolidate pruning exclusions and defer URL routing so it can run if any concurrent caller requests it.
- Add Vitest coverage for shared autosave behavior and finalization timing.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
| packages/playground/website/src/lib/state/redux/site-management-api-middleware.ts | Deduplicates concurrent autosave work via an in-flight map and consolidates routing/pruning behavior. |
| packages/playground/website/src/lib/state/redux/site-management-api-middleware.spec.ts | Adds tests verifying autosave promise sharing, finalization waiting, and option aggregation. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
adamziel
force-pushed
the
adamziel/serialize-opfs-autosaves
branch
2 times, most recently
from
July 21, 2026 12:51
b4f51a6 to
32a3970
Compare
adamziel
force-pushed
the
adamziel/serialize-opfs-autosaves
branch
from
July 21, 2026 12:51
32a3970 to
8d0d5f4
Compare
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.
Shares one in-flight autosave operation between concurrent callers for the same Playground.
Before this PR, duplicate
autosaveTemporarySite()calls ran the entire persistence pipeline twice: creating the pending OPFS record, copying the filesystem, updating metadata, and pruning old autosaves. PR #4136 serializes the final metadata writes; this follow-up prevents the duplicate pipeline in the first place.The in-flight entry is removed after success or failure, so a later call can retry normally.
Testing
Start two autosaves for one temporary Playground at the same time. Confirm both callers complete with the same stored Playground and only one persistence operation runs.