Repository navigation
feat(website): add an Octane version combobox to the playground - #2244
Conversation
The playground toolbar gets an editable, filterable "Octane version" combobox built on @octanejs/base-ui/combobox. main (the default) keeps the compiler and runtime bundled with the website; a published release loads its compiler and every sandbox runtime entry from esm.sh at that exact version, so octane and octane/internal/client share one runtime instance. The `version` query parameter is the source of truth and coexists with the workspace hash. Choosing a version loads its toolchain before the URL changes; a failed load keeps the running preview and never falls back to another version. The release list is fetched from npm on first open. Commit/PR revisions are not included: esm.sh's GitHub route rejects the monorepo, and per-revision preview builds stay blocked on a sponsored host. Refs #1022 Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website-mcp | 8c37d1b | Commit Preview URL Branch Preview URL |
Oct 26 2026, 08:33 PM |
Benchmark report🟢 No byte growth, no added work, and no timing changes beyond ±3%. Compares js-framework: 1k/10k row operationsAll 20 timed operations (20 without a verdict)
All 64 work counters are unchanged. Application bundle size (bytes)No changes across 111 measured values. Public-import reachability bundles (bytes)No changes across 129 measured values. |
A selection's URL write re-entered loadVersion for the version still loading and cancelled its own load, clearing the status early. A runtime import failure also left the release installed, so Retry and reselecting were no-ops. The new sandbox now boots in a hidden slot and replaces the running one only once its runtime has loaded; the same-version shortcut skips a load already in flight. Until any toolchain has loaded, the compiled pane shows nothing rather than main's output. Co-Authored-By: Claude Opus 5.5 <[email protected]>
Deploying with
|
| Status | Name | Latest Commit | Preview URL | Updated (UTC) |
|---|---|---|---|---|
| ✅ Deployment successful! View logs |
octane-website | 8c37d1b | Commit Preview URL Branch Preview URL |
Oct 26 2026, 08:33 PM |
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 2 potential issues.
Bugbot Autofix prepared fixes for both issues found in the latest run.
- ✅ Fixed: URL write still preempts version loads
- Moved
loadingVersion = nullfrom beforewriteVersionto aftercompileAndRunso the URL effect's re-entrantloadVersioncall hits the already-loading shortcut instead of the same-version branch that incrementsversionSeqand breaks the final status clear.
- Moved
- ✅ Fixed: Hidden sandbox leaks after unmount
- Added a
pendingPreviewvariable that tracks the in-flight preview duringawait readyand is destroyed in the cleanup function, so unmount no longer leaves detached iframe listeners alive until the ready timeout.
- Added a
Or push these changes by commenting:
@cursor push 52df57aa36
Preview (52df57aa36)
diff --git a/website/src/pages/playground/Playground.tsrx b/website/src/pages/playground/Playground.tsrx
--- a/website/src/pages/playground/Playground.tsrx
+++ b/website/src/pages/playground/Playground.tsrx
@@ -1246,6 +1246,7 @@
let loadingVersion: string | null = null;
let failedVersion: { param: string; fromUrl: boolean } | null = null;
let previewSlot: HTMLElement | null = null;
+ let pendingPreview: ReturnType<typeof pg.createPreview> | null = null;
const loadVersion = async (param: string, fromUrl: boolean) => {
const parsed = pgVersion.parseVersionParam(param);
const wanted = parsed.ok ? parsed.version : null;
@@ -1291,14 +1292,15 @@
slot.style.cssText = 'height:100%;display:none;';
previewHost.appendChild(slot);
const nextPreview = pg.createPreview(slot, onRuntimeError, next.runtime);
+ pendingPreview = nextPreview;
const readyError = await nextPreview.ready;
+ pendingPreview = null;
if (disposed || seq !== versionSeq || readyError) {
nextPreview.destroy();
slot.remove();
if (readyError && !disposed && seq === versionSeq) fail(readyError);
return;
}
- loadingVersion = null;
failedVersion = null;
pg.setPlaygroundCompiler(next.compiler);
toolchain = {
@@ -1324,7 +1326,10 @@
// The status stays up until the new sandbox has run the workspace:
// a release's runtime is still downloading from esm.sh until then.
await compileAndRun();
- if (!disposed && seq === versionSeq) setVersionLoading(null);
+ if (!disposed && seq === versionSeq) {
+ loadingVersion = null;
+ setVersionLoading(null);
+ }
};
controllerRef.current.loadVersion = (param, fromUrl) => {
if (!disposed) void loadVersion(param, fromUrl);
@@ -1389,6 +1394,7 @@
sourceView?.destroy();
outputView?.destroy();
astPreview?.destroy();
+ pendingPreview?.destroy();
preview?.destroy();
};
});You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit cf38dcf. Configure here.
|
Bugbot Autofix prepared fixes for both issues found in the latest run.
Or push these changes by commenting: Preview (7721f192c0)diff --git a/website/src/pages/playground/Playground.tsrx b/website/src/pages/playground/Playground.tsrx
--- a/website/src/pages/playground/Playground.tsrx
+++ b/website/src/pages/playground/Playground.tsrx
@@ -649,6 +649,7 @@
// re-tokenize of the output document. syncOutput re-runs this when
// the pane is revealed, so it refreshes exactly once, on demand.
if (resultModeRef.current.view !== 'compiled') return null;
+ if (!toolchain) return null;
if (resultModeRef.current.compiledMode === 'ast') {
const { entry, error } = astEntry(currentFile);
if (entry && entry.ast !== lastShownAst?.ast) {
@@ -970,9 +971,14 @@
// While a shared payload is gated, everything except EXECUTION
// happens — the visitor can inspect source and compiled output.
if (executionGated) return;
+ let runError: string | null = null;
await preview.run(graph).then((r: { error: string | null }) => {
- if (!disposed && r.error) setError(r.error);
+ if (!disposed && r.error) {
+ setError(r.error);
+ runError = r.error;
+ }
});
+ return runError;
};
const scheduleCompile = () => {
@@ -1241,10 +1247,9 @@
const loadVersion = async (param: string, fromUrl: boolean) => {
const parsed = pgVersion.parseVersionParam(param);
const wanted = parsed.ok ? parsed.version : null;
- if (wanted !== null && wanted === toolchain?.version) {
+ if (wanted !== null && wanted === toolchain?.version && !failedVersion) {
// Back on the running version — drop any superseded load.
versionSeq++;
- failedVersion = null;
setVersionLoading(null);
setVersionError('');
return;
@@ -1290,12 +1295,18 @@
lastShownCode = null;
lastShownAst = null;
setActiveVersion(next.version);
- if (!fromUrl) void writeVersion(next.version);
window.clearTimeout(compileDebounceId);
// The status stays up until the new sandbox has run the workspace:
// a release's runtime is still downloading from esm.sh until then.
- await compileAndRun();
- if (!disposed && seq === versionSeq) setVersionLoading(null);
+ const runResult = await compileAndRun();
+ if (disposed || seq !== versionSeq) return;
+ setVersionLoading(null);
+ if (typeof runResult === 'string') {
+ failedVersion = { param, fromUrl };
+ setVersionError(runResult);
+ } else if (!fromUrl) {
+ writeVersion(next.version);
+ }
};
controllerRef.current.loadVersion = (param, fromUrl) => {
if (!disposed) void loadVersion(param, fromUrl);You can send follow-ups to the cloud agent here. |
… sandboxes The first version load has no running toolchain to keep, so it installs at once again and compiles while the sandbox boots; only a swap stages behind readiness. Waiting on readiness for the first load left the compiled pane empty under a hovering pointer (website integration hover test). loadingVersion now clears after the swap's compile, so the selection's URL write no longer takes the same-version path and cancels the load. Unmount destroys a sandbox still booting in its hidden slot. The dev server pre-declares the npm leaves @octanejs/base-ui reaches through raw .tsrx, avoiding a mid-session optimize pass on /playground. Co-Authored-By: Claude Opus 5.5 <[email protected]>


Summary
Adds the Octane version combobox from #1022 to the playground toolbar. It covers main and published releases. Commit and PR revisions are not included: they need a build host, which the issue makes conditional on sponsorship (details below).
esm.sh/octane@X/compilerinto the page. The sandbox import map points every runtime entry (octane,octane/internal/client,octane/react,octane/signals,octane/signals/client) atesm.sh/octane@X/...?external=react,react-dom. esm.sh splits a package's internals into one module per file, so all entries import the samedist/runtime.mjsand share one runtime instance.external=react,react-domleaves React bare, so the sandbox's pinned React is the only copy.?version=0.16.0, alongside the existing workspace hash. Missing ormainmeans main. The URL is the source of truth:@octanejs/base-ui/combobox, using the deep subpath import the issue suggests.<label>, a live status region for loading, and an alert for errors.[email protected]."octane/signals" is not shipped by the selected Octane version.A release withoutcompileTypesInspectionshows that in the Types pane instead of crashing.Why commit/PR revisions are not in this PR
I tested the feasibility condition from the issue:
https://esm.sh/gh/octanejs/octane@<sha>/packages/octane/src/index.tsreturns HTTP 500 "repo is too large", so esm.sh cannot serve a revision directly./pr/would serve) needs a CI job that builds and publishes every PR/commit. That is a project-funded build, which the issue blocks until a host sponsors it.So the combobox accepts main and exact releases only. Any other
versionvalue gets an actionable error.Validation
pnpm typecheck:fileson all changed website files: cleanpnpm format:fileson the changed fileswebsite/tests/playground-version.test.ts(new),playground.test.ts,playground-modules.test.ts,playground-runtime.test.ts,playground-examples.test.ts: 124 passed. Coverage:versionparam contractinit {imports}path, which drops non-esm.sh URLs?version=?version=0.16.0#<same workspace hash>and the editor keeps its contents?version=0.2.7restores on load and the counter is interactive, so hooks work acrossoctaneandoctane/internal/client?version=0.0.99shows "[email protected] is not published on npm." with Retry and runs nothing?version=0.16.0#<hash>link in a new tab restores both, keeps the shared-code consent gate, and runs after approvalpnpm test/pnpm format:check/pnpm typecheckacross the whole repo: left to CIperf-review: not applicable (website only; nopackages/octane/src, compiler output, or binding hot path)concise-code:initcarriesimportsinstead of a manifest, and the import-map code is shared.Risk / follow-ups
@tsrx/core@^0.1.x) resolve when esm.sh builds them, so onlyoctaneitself is pinned exactly. The repo's@tsrx/corepatches do not apply to published releases.Provenance
agent-authored)🤖 Generated with Claude Code
Need help on this PR? Tag
@codesmith-botwith what you need.Note
Medium Risk
Loads third-party compiler/runtime from esm.sh and npm based on URL before user consent; sandbox init now accepts external import URLs (non-esm.sh entries are filtered).
Overview
Adds an Octane version picker to the website playground so examples can compile and run against main (bundled compiler + local runtime manifest) or an exact npm release loaded from esm.sh.
The
?version=query param is the source of truth: choosing a release fetches its compiler into the page and initializes the sandbox with esm.sh URLs per runtime entry (?external=react,react-dom), with staged preview swap so a failed load keeps the current toolchain. Module graph building now keys the compile cache on the active compiler and rejectsoctane/*imports that the selected release does not export.New
PlaygroundVersionCombobox(@octanejs/base-ui) lists releases from npm on first open; lockfile and package auditreact-parity.jsonhashes update for the website’s@octanejs/base-uidependency.Reviewed by Cursor Bugbot for commit 8c37d1b. Bugbot is set up for automated code reviews on this repo. Configure here.