Skip to content

Component is inserted after trailing static text in 2.0.0-rc.0 #3004

Closed

Description

@iamssen

Describe the bug

In Solid 2.0.0-rc.0, a component placed between static text nodes is inserted after the trailing text during client-side rendering.

import { render } from '@solidjs/web';

const root = document.querySelector('#root');

if (!root) {
  throw new Error('Root element not found');
}

function Format(props: { n: number }) {
  return <data value={props.n}>{props.n.toFixed(2)}</data>;
}

function Test() {
  return (
    <main>
      <p>
        (<Format n={1000} />)
      </p>
    </main>
  );
}

render(() => <Test />, root);

Your Example Website or App

https://stackblitz.com/edit/vitejs-vite-r2r1asn8?file=src%2Findex.tsx

Steps to Reproduce the Bug or Issue

  1. Open the StackBlitz example.
  2. Wait for the preview to load.
  3. Observe that it displays ()1000.00.

Expected behavior

The component should remain between the surrounding static text and render (1000.00).

Screenshots or Videos

No response

Platform

  • OS: macOS
  • Browser: Chrome
  • Version: 151.0.7922.138

Additional context

No response

Activity

  1. ryansolid commented on Aug 17, 2026

    @ryansolid
    Member

    Fixed upstream in the native compiler: ryansolid/dom-expressions@287875f6 (ships with the next @dom-expressions/compiler release; Solid picks it up on the version bump).

    This was a Rust-compiler-only bug — the Babel transform was unaffected. For a dynamic slot followed by static content, the dom generate anchored the insert on the following template node's walk position. But when static text also precedes the slot, the two texts merge into one node during HTML parsing (<p>()), so the walk resolved to null and the runtime appended the component at the end of the parent — ()1000.00.

    The compiler now mirrors Babel's wrappedByText rule: a slot boxed by text on both sides emits a dedicated <!> placeholder in the template (<p>(<!>)) and anchors the insert on it. The regression shape is pinned in the shared fixture both compilers compile, so output parity is enforced going forward.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions