Skip to content

fix(website): suppress aborted requests when switching playground targets - #125

Merged
leonidaz merged 1 commit into
mainfrom
fix/playground-target-switch-abort
Sep 16, 2026
Merged

leonidaz merged 1 commit into
mainfrom
fix/playground-target-switch-abort

Conversation

@leonidaz

@leonidaz leonidaz commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Switching playground targets while compilation is pending can show “signal is aborted without reason”: the canceled request's error handler checks the controller for the replacement request, which has not been aborted.

Capture each request's controller and ignore failures from superseded requests. Invalidate pending compilation before validating input so clearing the editor or exceeding the source limit also prevents stale results from overwriting the current state.

Validation:

  • pnpm test --project website — 47 tests passed.
  • pnpm --filter tsrx-website typecheck — passed.
  • pnpm exec prettier --check website-tsrx/src/components/compiler-demo.tsrx and git diff --check — passed.
  • Ad hoc harness executing the actual compile_source implementation — seven scenarios passed, covering target-switch cancellation, stale responses, empty/oversized input, current network/compiler errors, and cleanup.

No changeset: the private website is excluded from Changesets.


Note

Low Risk
Scoped to live-demo compile cancellation and error suppression in compiler-demo.tsrx; no API or auth changes.

Overview
Fixes spurious “signal is aborted without reason” (and similar) errors in the TSRX playground when a new compile supersedes an in-flight /api/compile request—e.g. switching output targets while compilation is pending.

compile_source now bumps request_id and aborts the previous AbortController immediately, including before empty-source and max-length validation, so stale fetches cannot win after the editor is cleared or limited. Each run keeps a local controller for fetch, and the catch path ignores failures when current_request_id !== request_id or the request was aborted, instead of only checking the shared active_controller (which may already point at the replacement request).

Reviewed by Cursor Bugbot for commit 437092e. Bugbot is set up for automated code reviews on this repo. Configure here.

@vercel

vercel Bot commented Sep 16, 2026 •

Copy link
Copy Markdown

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

Project Deployment Actions Updated
tsrx-website Ready Ready Preview Sep 16, 2026 10:27pm UTC
tsrx-website-mcp Ready Ready Preview Sep 16, 2026 10:27pm UTC

Request Review

@leonidaz
leonidaz merged commit b11b56d into main Sep 16, 2026
11 checks passed
@leonidaz
leonidaz deleted the fix/playground-target-switch-abort branch September 16, 2026 22:32
leonidaz added a commit that referenced this pull request Sep 26, 2026
…rs, and print JSX text from `raw` (#694, #693) (#711)

* fix(core): write a `>` in text as `>`, read it as text in containers, and keep character references in plain JSX text (#694, #693)

A `>` in template text compiled to a bare `>`, which esbuild, oxc, and
TypeScript reject and vue-jsx-vapor compiles to nothing. The `JSXText`
printer now writes `<`, `>`, `{`, and `}` as character references
(`escape_jsx_text`), which JSX decodes back to the same characters. Braces
reach it only from a raw-text `<script>` body, where they started an
expression container.

In an element in a `{…}` container, `jsx_readToken` read a `>` right after a
tag as code, dropping the text before it, and after a child container
reported TSX's error. A `>` is now text wherever template text is read, as
it is outside a container.

Text that acorn-typescript's JSX parser reads, in an element in a spread
argument or an unbraced attribute value, had its character references
decoded into `value`, so `&#123;x&#125;` compiled to the expression `{x}`
and the formatter printed it decoded. `jsx_parseText` now keeps the source
as `value`, as template text does.

The editor's completion mapping for `@`-leading text now stops before the
first escaped character, so it stays same-length and is found by its text.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* fix(core): print JSX text from `raw`, and keep acorn's decoded `value` (#693, #710)

The user decided #710: TSRX follows the JSX AST, where a `JSXText` node's
`value` has its character references decoded and `raw` keeps the text as
written, and printers print `raw`. So `jsx_parseText` no longer sets
`value` to `raw`. Instead the `JSXText` printer, `wrap_edge_whitespace`,
the editor's `@`-text completion mapping, and `@tsrx/prettier-plugin` read
`raw`, and the printer escapes `<`, `>`, `{`, and `}` in it as before.

A template text's `raw` spanned its comments, which `value` leaves out, so
printing it would have printed them as text. Its `raw` now leaves them out
too; the parser still reads its line breaks from the source it spans.

Co-Authored-By: Claude Opus 5.5 <[email protected]>

* style: format the runtime fixture

Co-Authored-By: Claude Opus 5.5 <[email protected]>

---------

Co-authored-by: Claude Opus 5.5 <[email protected]>

This branch was successfully deployed

2 active deployments
Preview – tsrx-website — 437092ee Deployed Sep 16, 2026 by vercel[bot]
Preview – tsrx-website-mcp — 437092ee Deployed Sep 16, 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.

1 participant