From 54d9f05ea527b6e4e448e2c694675ed28ed15fa1 Mon Sep 17 00:00:00 2001 From: Paul Bakaus Date: Mon, 27 Apr 2026 19:03:05 -0700 Subject: [PATCH] =?UTF-8?q?fix(live):=20land=20valid=20TSX=20through=20wra?= =?UTF-8?q?p=20=E2=86=92=20preview=20=E2=86=92=20accept=20=E2=86=92=20carb?= =?UTF-8?q?onize?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Closes #114. Three orthogonal bugs that surfaced together when live mode picked an element inside a Vite React/TSX component with sibling branches: 1. JSX wrapper insertion produced invalid TSX - Replacing a single picked JSX child with [comment,
, comment] yields three adjacent siblings, which oxc rejects with "Adjacent JSX elements must be wrapped in an enclosing tag." - A Fragment `<>` solves the adjacency case but breaks `cloneElement`-using parents (Radix `asChild`, Headless UI, etc.) with "Invalid prop supplied to React.Fragment." - Fix: keep the wrapper `
` as the single JSX-slot child and tuck both marker comments INSIDE it. accept/discard now expands its replacement range to include the wrapper's `
` open/close lines via div-depth tracking. 2. carbonize produced nested template literals in TSX `` template, then handleAccept re-wrapped with another pair, producing `` which oxc rejects with "Expected `}` but found `@`". - Fix: extractCss now strips a leading `{` and trailing `` `} `` wherever they appear in the captured content (own line OR attached to the first/last CSS line), so re-wrapping always yields exactly one `{` ` … ` `}` pair. 3. Ambiguous source matching for repeated JSX branches - `findElement` returned the first substring match. Multiple `