Skip to content

fix(playground): show the saved framework before the page loads its scripts - #4921

Merged
thetaPC merged 5 commits into
mainfrom
framework-first-paint
Dec 2, 2026
Merged

thetaPC merged 5 commits into
mainfrom
framework-first-paint

Conversation

@thetaPC

@thetaPC thetaPC commented Dec 2, 2026 •

Copy link
Copy Markdown
Contributor

Framework tabs and playgrounds open on Angular, then switch to the reader's saved framework once the scripts load. The server can't read localStorage, so it always renders the default.

  • An inline script in <head> copies the saved framework onto <html> before the page paints.
  • Until the page's scripts load, CSS uses that attribute to select the saved framework in FrameworkTabs and the playground switcher, and to show its panel.
  • Playgrounds with a default framework, like the navigation guides, are unchanged, since they always open on it.

How to test

In Chrome:

  1. Open Gestures and pick React in any framework tab.
  2. Open DevTools, press Cmd+Shift+P (Ctrl+Shift+P on Windows), and run Show Network request blocking.
  3. Tick Enable network request blocking, click +, and add *assets/js*.
  4. Reload. React is selected and its code shows.
  5. Repeat on production: it shows the default instead.

@vercel

vercel Bot commented Dec 2, 2026 •

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated
ionic-docs Ready Ready Preview Dec 2, 2026 6:14pm UTC

Request Review

@thetaPC
thetaPC marked this pull request as ready for review December 2, 2026 00:29
@thetaPC
thetaPC requested a review from a team as a code owner December 2, 2026 00:29
@thetaPC
thetaPC requested a review from ShaneK December 2, 2026 00:29

@brandyscarney brandyscarney left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

The fix looks great! Left a few optional suggestions. Just FYI for anyone testing: the pattern needs to be added to Chrome as *://*/**/assets/js/*.

Comment thread src/css/_mixins.scss Resolved

@brandyscarney brandyscarney left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

LGTM!

@thetaPC
thetaPC merged commit c0570e8 into main Dec 2, 2026
7 checks passed
@thetaPC
thetaPC deleted the framework-first-paint branch December 2, 2026 22:24

This branch was successfully deployed

1 active deployment
Preview — bbe8518f Deployed Dec 2, 2026 by vercel[bot]
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