Repository navigation
Upgrade the website playground: examples, multi-file tabs, Prettier, esm.sh imports - #190
Merged
Merged
Conversation
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
❌ Bugbot Autofix is OFF. To automatically fix reported issues with cloud agents, enable autofix in the Cursor dashboard.
Reviewed by Cursor Bugbot for commit 416214c. Configure here.
…esm.sh imports - Examples dropdown: 14 curated workspaces covering the TSRX/TSX surface (control flow, branch-local hooks, context, portals, dynamic tags, Suspense + use(), multi-file parallel use(), transitions, ViewTransition, form actions, zustand via esm.sh, and an OctaneCompat React-host demo), each gated by a test that compiles it warning-free through the real pipeline. - Multi-file workspaces: virtual file tabs with sibling imports, per-file undo history and compiled output, and a v2 share-hash format (v1 links still decode). `.react.tsx` marks React-host files compiled with sucrase. - Third-party imports: bare specifiers rewrite to esm.sh with `?external=octane`; the sandbox bootstrap installs an import map pinning octane (and octane/react) to locally built blob modules, so bindings share the singleton runtime. The runtime now ships as a code-split JSON manifest (octane + octane/react entries over a shared core chunk) and the sandbox CSP permits exactly module loads from esm.sh, nothing else. - Format button: client-side prettier/standalone + @tsrx/prettier-plugin (vite-aliased bare `prettier` to the standalone build), repo style output. - octane/compiler: vite.js and bundler.js now import node builtins in namespace form so evaluating the compiler entry in a browser dev server (externalized node:* shims) no longer throws; no behavior change in Node. - Worked around the first-router-event-after-hydration route-tree remount (tracked separately) by priming router.load() at playground boot, and added sessionStorage own-hash trust so reloads of your own code never re-hit the shared-link consent gate. Co-Authored-By: Claude Fable 5 <[email protected]>
…xamples - The OctaneCompat e2e no longer runtime-skips when esm.sh is unreachable (the lint gate bans skip modifiers); an up-front probe now turns an unreachable CDN into an immediate, clearly-attributed failure instead. - Bugbot: the OctaneCompat Island created its fetch promise in the parent body every render, so unrelated updates (the click counter) resuspended the @Try boundary. The Island — and both Suspense examples, which taught the same antipattern — now create the promise AT the use() call site, where octane's parallel-use memoization keys it by deps; only changed inputs refetch. Verified in-browser: island clicks keep the data visible, Refetch still refetches. - The examples dropdown's "Custom" placeholder is now a static hidden option instead of a conditional branch inside <select>, so the option list never reconciles. Co-Authored-By: Claude Fable 5 <[email protected]>
Bugbot: a late runtime-error from a superseded run (e.g. a timer firing after a recompile) could post after the newer run's clean render and stick in the error banner. The sandbox now stamps runtime-error messages with the originating run's generation and the parent drops any that don't match the current run; covered by a unit test driving the postMessage protocol. Co-Authored-By: Claude Fable 5 <[email protected]>
Main's fix for the first-post-hydration-update remount (#192) makes the playground's boot-time router.load() prime unnecessary — the first hash write no longer tears down the route tree. Verified in-browser: the preview iframe survives the first replaceState and example switches across hash writes keep the original instance. Co-Authored-By: Claude Fable 5 <[email protected]>
trueadm
force-pushed
the
playground-upgrade
branch
from
July 19, 2026 23:35
9801aa6 to
85c8896
Compare
Browsers request <link rel=manifest> anonymously by default, so on SSO-protected Vercel preview deployments the manifest fetch loses its auth cookie, gets redirected to the vercel.com login, and surfaces as a CORS error in the console on every page. crossorigin="use-credentials" makes the manifest request carry cookies; same-origin production requests are unaffected. Co-Authored-By: Claude Fable 5 <[email protected]>
…k gap A real browser pick (popup commit, keyboard typeahead) dispatches trusted `input` and `change` in SEPARATE tasks with microtask checkpoints between them. The controlled-select restore ran in that gap, snapping the selection back to the rendered value before `change` dispatched — so every controlled select's onChange read the OLD value and user picks could never commit. Synthetic events (tests, Playwright selectOption) dispatch both in one task and never hit the gap, which is how the whole suite stayed green while real users couldn't switch the playground's examples dropdown. The `input` dispatch now marks the pick in flight on the element (the same window design as checkable activation): the `change` dispatch owns the after-handlers restore, and a task fallback settles sequences whose `change` never completes (stopped propagation below the root, or a synthetic lone `input`). Regression test drives the real two-task event sequence and failed before the fix; the input-only settle test moves from the microtask to the task boundary it now guarantees. Also gives the playground's example dropdown a custom chevron with breathing room from the right edge (appearance: none + inline SVG). Co-Authored-By: Claude Fable 5 <[email protected]>
This branch was previously deployed
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
A major upgrade to the
/playgroundpage, plus one smalloctane/compilerfix it surfaced.Examples dropdown
14 curated workspaces grouped by topic, covering the TSRX and TSX API surface: counter (new whitespace-friendly default), keyed lists, inputs +
@switch, branch-local hooks, context, portals, dynamic tags<{expr}>, Suspense +use()(both dialects), multi-file paralleluse(), transitions/deferred values, ViewTransition, form actions, a zustand-via-esm.sh demo, and an OctaneCompat demo — a real React 19 host (App.react.tsx, mounted by react-dom from esm.sh) rendering a compiled Octane island with its own@try/@pendingSuspense. A unit test compiles every example variant warning-free through the real pipeline, so the dropdown can't rot.Multi-file workspaces
Svelte-REPL-style file tabs with sibling imports (static and dynamic), per-file undo history, per-file compiled output, and a v2 share-hash format (
{v:2, l, e, f}) — old single-file links still decode..react.tsxmarks React-host files, compiled with sucrase's automatic react-jsx transform instead of the octane compiler.Third-party imports (esm.sh + import map)
Bare specifiers rewrite to
https://esm.sh/<pkg>?external=octane. The sandbox bootstrap (now a classic script) installs a single import map before any module loads, pinningoctane/octane/reactto locally built blob modules — so@octanejs/*bindings from the CDN share the singleton runtime — and the react family to pinned esm.sh builds. The runtime ships as a code-split JSON manifest (octane+octane/reactentries over a shared core chunk; react external, so pure-octane sessions stay fully offline). The sandbox CSP loosens to exactlyscript-src … https://esm.sh; everything else (fetch/XHR, forms, navigation) stays blocked, and the consent gate for shared links is unchanged.Prettier button
Client-side
prettier/standalone+@tsrx/prettier-plugin(.tsrx) / typescript plugin (.tsx), matching repo style, with Ctrl/Cmd-Shift-F. Bareprettieris vite-aliased toprettier/standaloneto satisfy the plugin'simport { doc } from 'prettier'; the estree plugin rides along because standalone sources its core option definitions from it.octane/compilerbrowser-eval fixcompiler/vite.jsandcompiler/bundler.jsused named imports fromnode:*, which throw at module evaluation against a dev server's externalized shims — so importingoctane/compilerin a browser dev graph crashed (latent on main; dev doesn't tree-shake the entry's re-exports). They now use namespace imports (member access only throws if a Node-only path actually runs). No behavior change in Node; changeset included (patch).Router remount workaround
Diagnosed a pre-existing bug where the first router event after SSR hydration remounts the whole route tree (tracked separately, being fixed in its own session). The playground absorbs it by priming
router.load()at boot before the editor exists, and a sessionStorage own-hash record keeps reloads/remounts of your own code from re-hitting the shared-link consent gate. Both are annotated for removal once the root cause lands.Testing
pnpm test: 1213 files / 11,677 tests green, including new suites:playground-modules.test.ts(specifier policy, sibling resolution, cycles, sucrase, ordering),playground-examples.test.ts(every example compiles warning-free + hash round-trip),playground-format.test.ts(style + idempotence), and updated sandbox/hash/route-shell tests.ssr-hydration.e2e.test.ts, real Chromium against dev + production preview): existing counter/warning tests updated, plus new coverage — multi-file example via the dropdown (tabs, sibling module, tab switching), Format button, gated multi-file share link → consent → run, and a network-guarded OctaneCompat end-to-end test (react-dom host + island data + events across the boundary; skips with a logged reason if esm.sh is unreachable).pnpm typecheckandpnpm format:checkgreen; evals corpus regenerated for the lockfile change.🤖 Generated with Claude Code
Note
Medium Risk
Changes core controlled-select event timing and broad playground execution surface (sandbox, CSP, CDN imports); compiler import shape is low risk in Node but affects every dev import of
octane/compiler.Overview
The
/playgroundpage becomes a multi-file REPL: file tabs, sibling imports, per-file undo and compiled output, a v2 share hash (legacy single-file links still decode), an examples dropdown (14 curated workspaces), client-side Prettier (TSRX/TSX), esm.sh bare imports with an import map pinningoctaneto local blobs, and.react.tsxhost files via sucrase for the OctaneCompat demo. CSP and sandbox wiring expand only as needed foresm.sh; shared links still require explicit Run consent, with sessionStorage and a routerload()priming workaround until a separate hydration remount fix lands.octanegains two patch-level runtime/tooling fixes bundled with the playground work: controlled<select>no longer restores on a microtask between nativeinputandchange(picks stay visible untilchangeruns, with a task fallback for loneinput), andoctane/compilerre-exports use namespacenode:*imports so browser dev graphs can evaluatevite.js/bundler.jswithout named-import shim failures. Eval train manifest overlay lockfile hashes and root lockfile/catalog entries (es-module-lexer,sucrase, website dev deps) are refreshed to match.Reviewed by Cursor Bugbot for commit 2423c7a. Bugbot is set up for automated code reviews on this repo. Configure here.