Repository navigation
Description
Feature
Add one editable, searchable Octane version combobox to the playground toolbar. The same control offers main and published releases and accepts a typed commit SHA or PR number; users should not need separate version, commit, and PR controls.
Keep main as the default. This option should use the Octane compiler and runtime bundled with the website build, retaining the ability to exercise unreleased changes without an npm release.
Selecting a published version should load that version's Octane packages and entry points through esm.sh.
Combobox interaction
- Label the control Octane version. Show main as the initial selection and the first option, followed by available published versions. Typing filters the version list.
- Accept a commit SHA, a PR number such as
1021or#1021, and an Octane PR URL. Also accept explicitcommit:<sha>andpr:<number>forms; interpret bare positive integers as PR numbers so numeric input is unambiguous. - When input looks like a revision, offer a selectable row such as Use commit abc1234 or Use PR fix: support signals in the website playground #1021 in the same popup. The commit or PR need not already exist in the release list.
- Clicking an option or confirming it with Enter resolves and loads that target. Typing and highlighting only edit the draft query; they must not trigger builds, change the URL, or switch the active runtime. Escape cancels editing and restores the active selection's label.
- After PR resolution, show its number and resolved short SHA. Loading and validation errors appear beside the same control, with a retry path; retain the current running preview if resolution fails.
- Keep keyboard navigation, visible focus, an accessible input label, and announced loading/error states. The control should fit the existing desktop and mobile toolbar.
Suggested implementation using the existing Octane binding
Use the ported @octanejs/base-ui/combobox as the first candidate. Its local public API already includes controlled selection and input state, custom item filtering, and the popup/list parts needed here. Start from the repository implementation rather than assuming every example in newer upstream documentation applies.
import { Combobox } from '@octanejs/base-ui/combobox';- Add
@octanejs/base-uias aworkspace:*dependency of the website. Build a smallPlaygroundVersionCombobox.tsrxbeside Playground.tsrx, using the deep subpath import above. - Compose
Combobox.Root,Input,Trigger,Portal,Positioner,Popup,List,Item, andStatus; give the input an associated native label. Apply the website's toolbar styles to the headless parts. - Keep draft text (
inputValue/onInputValueChange) separate from the committed target (value/onValueChange). Model items as typed main/release/commit/PR choices with stable identities and display labels viaitemToStringLabel. - Build the visible items from filtered releases plus a synthetic commit/PR candidate. The binding supports
filteredItemsandfilter={null}for application-managed filtering, so the generated candidate should remain selectable even when no release matches. Keep the active choice available to the item model so its label survives filtering. - Route a confirmed option through a shared resolver used by both the combobox and query-string initialization. It should return an exact release or
{ repository, sha, pr? }, then coordinate compiler loading, preview replacement, and URL updates. Cancel or ignore stale requests when another target is selected. - Compile and run this UI with the website's own Octane version. Only the example compiler/runtime changes with the selected target; the toolbar binding must not be loaded against an arbitrary old Octane release or PR revision.
Relevant sources: binding README, exported combobox parts, controlled selection props, and input/items/filtering props. The upstream Combobox documentation provides interaction and composition examples; adapt them to the checked-in Octane port.
Test the actual toolbar control: selecting main/releases, typing a SHA or PR number, choosing a generated option with the keyboard, Escape cancellation, invalid input, stale async results, and URL restoration. Keep the runtime-loading and sponsorship requirements below.
URL behavior
- Persist the selected version in a query parameter, proposed as
version:/playground→ main (default)/playground?version=main→ main/playground?version=0.2.7→ the exact published release
- Read the query parameter on initial load and load the requested version before compiling or executing the example.
- Update the query string when the selector changes, preserving other query parameters and the existing source/workspace hash.
- Copying or sharing a playground URL must include the selected version. Pasting that URL into a new tab or browser must restore both the version and the shared workspace.
- Keep the selected version, URL, compiler, and running preview consistent when navigating browser history.
Acceptance criteria
- The selector offers main and available published Octane versions.
- Missing
versiondefaults to main, preserving existing playground links. - main uses the locally bundled compiler/runtime; published releases load through esm.sh and are pinned to the exact selected version.
- The compiler, runtime, and Octane subpath imports all resolve consistently to the selected version, sharing runtime state rather than mixing versions or runtime instances.
- Changing the version recompiles the current workspace and replaces the preview runtime without losing editor contents.
- Invalid versions, unavailable releases, loading failures, and entry points absent from an older release produce an actionable error. Do not silently execute against a different version.
- Existing sandbox isolation and consent for shared code remain in place.
- Regression coverage verifies the main default, published-version selection, query-string restoration, and copying/pasting a URL containing both a version and a workspace hash.
Extension: select a commit or pull request
The same combobox accepts an Octane commit SHA or PR number/URL alongside main and published npm versions. This lets contributors reproduce regressions and try fixes before merge or release.
- Resolve a PR to its head repository and full commit SHA, including PRs from forks; show the selected PR and resolved revision.
- Load the compiler, runtime, and supported Octane subpaths from that same revision.
- Extend the query-string contract to represent commit and PR selections. Proposed canonical share URLs:
?version=commit:<full-sha>and?version=commit:<full-sha>&pr=<number>when retaining PR context. - A PR selection may initially resolve its current head, but copied/shared URLs must pin the resolved SHA so subsequent PR updates do not silently change an existing reproduction. Offer an explicit way to load a newer PR head.
- Preserve workspace hashes and other URL parameters. Opening a pasted URL restores the exact revision and workspace before compilation/execution. main remains the default when no version is supplied.
- Surface unavailable revisions, unsupported historical entry points, and pending or failed builds without silently falling back to main or an npm release.
Feasibility and hosting condition
First investigate whether esm.sh can serve the required revision directly, without an Octane-operated build service or additional build costs for the project. If it can, use that route. If preparing or serving commit/PR builds would incur costs for us, this extension is conditional on a hosting sponsor covering those costs. Do not launch a self-funded arbitrary-revision build service.
Initial findings:
- esm.sh documents GitHub imports pinned to commit hashes via
/gh/owner/repo@commit/path, plus TypeScript source transformation. This makes direct commit loading worth testing, but does not establish compatibility with Octane's monorepo, package subpaths, or catalog dependency declarations. esm.sh documentation - esm.sh also supports preview packages published through pkg.pr.new via
/pr/…. Supported registries - pkg.pr.new supports monorepo packages but requires a workflow to prepare/publish previews; its documentation specifically requires
--pnpmfor catalog dependencies. This may solve package preparation, but CDN delivery alone does not eliminate our CI/build costs. pkg.pr.new setup and packaging
Before choosing an implementation:
- Prove whether direct esm.sh loading can compile and execute a real Octane example at a pinned commit, with matching compiler/runtime versions and shared runtime state across entry points.
- Verify PR/fork revision resolution, dependency pinning, cache behavior, availability/retention, and any service limits or costs. Treat zero cost as something to establish, not an assumption from URL support.
- If direct loading is insufficient, evaluate whether lightweight preview-package publication is enough; account for any install, packaging, build, storage, and delivery costs.
- If a build host is required, secure sponsorship before enabling the feature. Cache and deduplicate artifacts by immutable revision and define bounded build concurrency and retention within the sponsored capacity. Preserve sandbox isolation for untrusted PR code.
This hosting condition applies to commit/PR previews and should not block the main/published-version selector.
Additional acceptance criteria
- Commit and PR selections load the requested revision, including fork PR heads.
- Copied URLs reproduce the pinned revision even after the PR receives new commits.
- Switching revisions keeps editor contents and replaces the compiler and preview consistently.
- The selected delivery approach has demonstrated compatibility and documented cost/limit assumptions; any project-funded build requirement remains blocked until a host sponsors it.
- Regression coverage includes direct commit URLs, PR-to-SHA resolution, share-link restoration after a PR update, and unavailable or failed revisions.
Motivation
The current playground bundles Octane with the website. Keeping that main option while adding published versions would make it possible to reproduce version-specific bugs, compare release behavior, and share examples whose framework version is explicit.
Activity
[-]feat: add an Octane version selector to the playground[/-][+]feat: add an Octane version, commit, and PR combobox to the playground[/+]feat(website): add an Octane version combobox to the playground (#2244)