Skip to content

[playground] fix: don't show compilation spinner when toggling dark mode#10392

Open
JennyPng wants to merge 2 commits intomicrosoft:mainfrom
JennyPng:modefix
Open

[playground] fix: don't show compilation spinner when toggling dark mode#10392
JennyPng wants to merge 2 commits intomicrosoft:mainfrom
JennyPng:modefix

Conversation

@JennyPng
Copy link
Copy Markdown
Member

@JennyPng JennyPng commented Apr 15, 2026

I noticed the playground compilation spinner appears when the dark mode toggle is clicked, which doesn't seem desirable

  • When the dark mode toggle fires, WebsitePlayground re-renders and recreates imports (from .filter()) and importConfig ({ useShim: true }) as new object references

  • These are dependencies of the useEffect in useStandalonePlaygroundContext in standalone.tsx, which re-runs the entire host creation and triggers the compile effect. So memoizing these to avoid that

  • change to base-layout is because I noticed if I have dark mode, when switching pages, it briefly flashes to light mode before switching back to dark mode

@microsoft-github-policy-service microsoft-github-policy-service bot added the meta:website TypeSpec.io updates label Apr 15, 2026
@azure-sdk
Copy link
Copy Markdown
Collaborator

azure-sdk commented Apr 15, 2026

You can try these changes here

🛝 Playground 🌐 Website 🛝 VSCode Extension

@JennyPng JennyPng marked this pull request as ready for review April 15, 2026 19:48
@github-actions
Copy link
Copy Markdown
Contributor

No changes needing a change description found.

<link rel="og:image" type="image/svg+xml" href={baseUrl("/img/social.svg")} />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>typespec.io</title>
<script is:inline>
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.

intresting, I only seem to see this when switching from docs -> playground, do you see that in more places?

This seems like duplicate code f rom theme.ts so wondering here if we are maybe not missing an import somewhere or we can combine the logic at least

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

meta:website TypeSpec.io updates

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants