Add autosaved site lifecycle APIs#3674
Open
adamziel wants to merge 1 commit into
Open
Conversation
0f8ad0e to
5607d06
Compare
6d845e9 to
7175499
Compare
5607d06 to
2baf0e2
Compare
7175499 to
d13a74c
Compare
2baf0e2 to
aa15a20
Compare
d13a74c to
071c74c
Compare
aa15a20 to
d906dee
Compare
071c74c to
f0eaf10
Compare
de0d683 to
a349ef7
Compare
f0eaf10 to
ca2c069
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.
Adds a persistence/lifecycle layer for “autosaved” Playgrounds, enabling Redux and the Sites API to distinguish temporary vs stored sites, track recency, and prune old autosaves.
Changes:
- Introduces site lifecycle utilities (autosave vs explicit, recency timestamps, autosave pruning).
- Adds stored-site creation + autosave/keep flows to the Sites API and persistence pipeline.
- Updates boot/persist logic to record last-used metadata and support background OPFS sync for fresh installs.
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated 4 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/playground/website/src/lib/state/redux/store.ts | Adds updateUrl control when activating a site. |
| packages/playground/website/src/lib/state/redux/slice-sites.ts | Adds stored-site creation, preserve/prune helpers, slug normalization, recency sorting, and metadata fields. |
| packages/playground/website/src/lib/state/redux/slice-sites.spec.ts | Adds unit coverage for slug normalization and autosave lifecycle helpers. |
| packages/playground/website/src/lib/state/redux/slice-clients.ts | Annotates OPFS sync state with operation type (save vs autosave). |
| packages/playground/website/src/lib/state/redux/site-slug.ts | Adds slug normalization + collision-free slug generation helpers. |
| packages/playground/website/src/lib/state/redux/site-management-api-middleware.ts | Expands Sites API for autosave/keep/createSavedSite and URL update control. |
| packages/playground/website/src/lib/state/redux/site-lifecycle.ts | New lifecycle helpers: recency, autosave detection, pruning selection. |
| packages/playground/website/src/lib/state/redux/persist-temporary-site.ts | Adds autosave-aware persistence options, URL update control, and client-preserving saves. |
| packages/playground/website/src/lib/state/redux/boot-site-client.ts | Tracks whenLastUsed, supports initial OPFS sync pending, and background sync progress reporting. |
| packages/playground/website/playwright/e2e/sites-api.spec.ts | Adjusts e2e expectations for new storage outcomes and temp-site navigation. |
Comments suppressed due to low confidence (1)
packages/playground/website/src/lib/state/redux/site-management-api-middleware.ts:42
- The API now exposes
persistence, but it is typed asstring, which weakens the contract for API consumers and makes it easy to return unsupported values. Since you already haveSitePersistence('autosave' | 'explicit'), typepersistenceasSitePersistence(and consider similarly narrowingstorageto the known set including'temporary').
export interface PlaygroundSitesAPI {
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
5abb063 to
79dc611
Compare
79dc611 to
4b67318
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.
What it does
Adds the Redux lifecycle and management APIs for autosaved Playgrounds.
The site model can now distinguish temporary, autosaved, and explicitly saved
sites, track last-use metadata, and expose create/keep/discard behavior through
the site management API.
Rationale
The default autosave UI needs a consistent persistence model underneath it.
Keeping this API layer separate makes the behavior reviewable without mixing in
the browser chrome and overlay changes.
Implementation
Adds lifecycle helpers, slug generation, reducer coverage, client boot handling,
temporary-site persistence updates, and API middleware support for autosaved
sites.
This is stacked on
feature/save-url-foundationsbecause autosave restore logicuses the setup URL fingerprint added there.
Testing instructions