Skip to content

fix(ts-optimizer): rewrite captured props used as JSX tags - #9129

Closed
maiieul wants to merge 4 commits into
claude/ts-optimizer-prop-jsx-tags-a647effrom
claude/ts-optimizer-captured-prop-jsx-tags-78cd16
Closed

maiieul wants to merge 4 commits into
claude/ts-optimizer-prop-jsx-tags-a647effrom
claude/ts-optimizer-captured-prop-jsx-tags-78cd16

Conversation

@maiieul

@maiieul maiieul commented Oct 3, 2026

Copy link
Copy Markdown
Member

What is it?

  • Bug

Description

With the TypeScript optimizer, a destructured prop used as a JSX tag inside a $ callback (onClick$={() => render(<Model />)}) kept its bare name, so the segment read an undefined Model. It now compiles like the Rust optimizer: _jsxSorted(_rawProps.Model ?? Fallback, …).

JSX tag names only hold member chains, so a prop read with a default or a
string key (`<props.Model ?? Fallback/>`) failed to parse. Those tags are now
rewritten once the JSX is transpiled, as Rust does. Member tags (`<ui.Home/>`)
were never rewritten and pointed at the removed destructure.
…rop-jsx-tags-a647ef

# Conflicts:
#	packages/ts-optimizer/src/optimizer/rewrite/raw-props.ts
A child segment rewrote only identifier reads of captured props, so
`<Model />` inside `onClick$` kept the removed binding. Its tags now
follow the component-body rule: member chains are rewritten in the JSX,
and reads with a default or a string key once the JSX is transpiled.
@changeset-bot

changeset-bot Bot commented Oct 3, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: 6d77ec8

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 8 packages
Name Type
@qwik.dev/core Patch
@qwik.dev/devtools Patch
eslint-plugin-qwik Patch
@qwik.dev/mcp Patch
@qwik.dev/react Patch
@qwik.dev/router Patch
@qwik.dev/utils Patch
create-qwik Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@maiieul maiieul self-assigned this Oct 3, 2026
@maiieul
maiieul added this pull request to stack #9130 October 3, 2026 09:22
@pkg-pr-new

pkg-pr-new Bot commented Oct 3, 2026

Copy link
Copy Markdown

Open in StackBlitz

@qwik.dev/core

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/core@9129

@qwik.dev/router

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/router@9129

@qwik.dev/utils

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/utils@9129

eslint-plugin-qwik

npm i https://pkg.pr.new/QwikDev/qwik/eslint-plugin-qwik@9129

create-qwik

npm i https://pkg.pr.new/QwikDev/qwik/create-qwik@9129

@qwik.dev/optimizer

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/optimizer@9129

@qwik.dev/devtools

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/devtools@9129

@qwik.dev/mcp

npm i https://pkg.pr.new/QwikDev/qwik/@qwik.dev/mcp@9129

commit: 6d77ec8

@github-actions

github-actions Bot commented Oct 3, 2026 •

Copy link
Copy Markdown
Contributor
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
qwik-docs ✅ Ready (View Log) Visit Preview 6d77ec8

@maiieul
maiieul force-pushed the claude/ts-optimizer-prop-jsx-tags-a647ef branch 2 times, most recently from e73f129 to 3e98cb9 Compare October 5, 2026 09:30
@maiieul
maiieul removed this pull request from stack #9130 October 5, 2026 10:34
@maiieul

maiieul commented Oct 5, 2026

Copy link
Copy Markdown
Member Author

Folded into #9127 as its second commit, since both fix destructured props used as JSX tags.

@maiieul maiieul closed this Oct 5, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Archived in project

Development

Successfully merging this pull request may close these issues.

1 participant