solidjs / solid

A declarative, efficient, and flexible JavaScript library for building user interfaces.
https://solidjs.com
MIT License
31.64k stars 887 forks source link

[Astro] resource and signal rendering is mixed up on the client #2135

Closed PeterDraex closed 2 months ago

PeterDraex commented 2 months ago

Describe the bug

I'm rendering a resource and a signal:

  return (
    <>
      resource: {data()}
      <br />
      signal: {isMounted() ? 'yes' : 'no'}
    </>
  );

But in Astro, the resource gets render output is:

resource: nopesignal: nonope
signal: yes

Your Example Website or App

https://stackblitz.com/edit/github-pqy8j7-3kzkkj?file=src%2Fcomponents%2FPage.tsx

Steps to Reproduce the Bug or Issue

-

Expected behavior

In pure SolidJS, the output is correct:

resource: nope
signal: yes

Screenshots or Videos

No response

Platform

Windows, Chrome 123

Additional context

No response

elite174 commented 2 months ago

One solution is: wrap data with span

    resource: <span>{data()}</span>
    <br />
    signal: {isMounted() ? 'yes' : 'no'}
ryansolid commented 2 months ago

I swore I fixed this top level fragment issue in Astro. And I had but I missed a case where it resolves for the first time under a Suspense boundary.