New tab for html project works for other locales#1458
Open
abcampo-iry wants to merge 1 commit intomainfrom
Open
New tab for html project works for other locales#1458abcampo-iry wants to merge 1 commit intomainfrom
abcampo-iry wants to merge 1 commit intomainfrom
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Fixes HTML “Preview in new tab” for unsaved starter projects opened under localized routes (e.g., en-US) by allowing browser-preview loads to reuse the locally cached project even when the cached project’s locale differs from the route locale.
Changes:
- Update
useProjectcache-loading rules to treatbrowserPreview=true(from Redux state or query string) as a signal to load cached projects even when locales don’t match. - Add a regression test ensuring embedded browser preview uses the cached project despite a locale mismatch.
- Reset
window.historyin embedded tests to avoid query-string leakage across tests.
Reviewed changes
Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
| src/hooks/useProject.js | Adjusts cache eligibility and locale-matching logic for browser preview loads. |
| src/hooks/useProject.test.js | Adds coverage for embedded browser preview with locale mismatch and resets URL state after tests. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
cafc68e to
668a8b5
Compare
668a8b5 to
ffa36a2
Compare
ffa36a2 to
6963ca2
Compare
f89e2c6 to
35f46e7
Compare
35f46e7 to
4d9c81e
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.
closes: 1322
Fixes HTML “Preview in new tab” for unsaved projects opened in localized routes such as
en-US.Unsaved starter projects are cached locally with their source locale, often
en.The browser preview route uses the current URL locale, for example
en-US, so the cached unsaved project was rejected and the preview loaded a fresh blank starter instead.This change lets
browserPreview=trueloads use the matching cached project even when the cached locale differs from the route locale.Update from copilot comment: the
?browserPreview=truecache bypass is now scoped to embedded previews only.WebComponentLoaderpasses its existingembeddedprop intouseProject, so normal editor routes with?browserPreview=truestill require the cached project locale to match. Embedded preview tabs can still load unsaved cached changes across locale fallbacks, which preserves the original fix.I've checked the other repos and we are effectively passing the prop and tested so we should be good.
Screen.Recording.2026-05-07.at.17.57.26.mov