Skip to content

fix: regular js stays regular, disallow early return in @ control flow#1269

Merged
leonidaz merged 1 commit into
mainfrom
return
Jun 13, 2026
Merged

fix: regular js stays regular, disallow early return in @ control flow#1269
leonidaz merged 1 commit into
mainfrom
return

Conversation

@leonidaz

@leonidaz leonidaz commented Jun 13, 2026

Copy link
Copy Markdown
Collaborator

Note

High Risk
This is a breaking semantic change for anyone relying on reactive plain-if guards or return inside @try blocks; compiler output and Solid/Ripple runtime behavior shift in core template lowering paths.

Overview
Aligns template semantics so only @if / @for / @switch / @try lower to template control flow; plain if / loops / switch / try in @{ … } compile like normal function bodies (JSX returntsrx_element), and return inside @try / @catch / @pending is rejected with the same template-return diagnostic as other @-blocks.

On Ripple, the compiler drops return_guard and related _$_.if wrapping: early return is a real early return, so trailing markup is skipped without guard flags (client/server snapshots updated). Analysis no longer errors on plain loops; break / continue / return rules apply only when the enclosing loop is a @for (metadata.tsrxDirective === 'for').

On Solid, plain guards like if (signal()) return … are no longer lifted to <Show>—they run once at setup; reactive conditionals require @if. @-directives and control flow that can throw still lower reactively. Shared isTemplate*Node helpers move to @tsrx/core for consistent directive detection.

Tests and runtime expectations are updated for the new guard behavior (e.g. Vite Solid: flipping a signal after a plain guard does not swap branches).

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

@vercel

vercel Bot commented Jun 13, 2026

Copy link
Copy Markdown

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

Project Deployment Actions Updated (UTC)
new-website Ready Ready Preview, Comment Jun 13, 2026 10:55pm
ripple Ready Ready Preview, Comment Jun 13, 2026 10:55pm
ripple-website-mcp Ready Ready Preview, Comment Jun 13, 2026 10:55pm
ripple-website-tsrx Ready Ready Preview, Comment Jun 13, 2026 10:55pm

Request Review

@pkg-pr-new

pkg-pr-new Bot commented Jun 13, 2026

Copy link
Copy Markdown
@ripple-ts/adapter

pnpm add https://pkg.pr.new/@ripple-ts/adapter@1269

@ripple-ts/adapter-bun

pnpm add https://pkg.pr.new/@ripple-ts/adapter-bun@1269

@ripple-ts/adapter-node

pnpm add https://pkg.pr.new/@ripple-ts/adapter-node@1269

@ripple-ts/cli

pnpm add https://pkg.pr.new/@ripple-ts/cli@1269

create-ripple

pnpm add https://pkg.pr.new/create-ripple@1269

@tsrx/eslint-parser

pnpm add https://pkg.pr.new/@tsrx/eslint-parser@1269

@tsrx/eslint-plugin

pnpm add https://pkg.pr.new/@tsrx/eslint-plugin@1269

@tsrx/prettier-plugin

pnpm add https://pkg.pr.new/@tsrx/prettier-plugin@1269

ripple

pnpm add https://pkg.pr.new/ripple@1269

@ripple-ts/rollup-plugin

pnpm add https://pkg.pr.new/@ripple-ts/rollup-plugin@1269

@tsrx/typescript-plugin

pnpm add https://pkg.pr.new/@tsrx/typescript-plugin@1269

@ripple-ts/vite-plugin

pnpm add https://pkg.pr.new/@ripple-ts/vite-plugin@1269

commit: 0c7cd93

@leonidaz leonidaz merged commit 8747e8f into main Jun 13, 2026
15 checks passed
@leonidaz leonidaz deleted the return branch June 13, 2026 22:57
@github-actions github-actions Bot mentioned this pull request Jun 13, 2026
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