You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I added a stackblitz - it works there but on local env it won't work (and also not on a server).
It seems like we need to co-locate cache and use-server functions to the same file and we cannot split them.
When I declare my cache in a different file - it does not render clientOnly component.
I'm using SolidStart and I'm trying to render component based on createAsync result. This component is wrapped with clientOnly - because it depends in the DOM.
It did not render this component.
Here is a small reproduction
import{getData}from"./server"importTestfrom"./Test";constTestClientOnly=clientOnly(()=>import("./Test"));exportfunctionMyComponent(){consta=createAsync(async()=>{return{data: awaitgetData()};});return(<Suspense><Showwhen={a()}fallback={<div>Loading tierlist</div>}>{/* This will not render anything ⚠️ only the fallback */}{(a)=><TestClientOnlyfallback={"Fallback why?"}/>}{/* This will render Test ✅*/}{(a)=><Test/>}</Show></Suspense>);
The result is that the TestClientOnly component does not rendered anything and goes into the fallback (if provided) to "Fallback why"
Expected behavior 🤔
The component will be shown and render (same as <Test/>)
Steps to reproduce 🕹
importTestfrom"./Test";constTestClientOnly=clientOnly(()=>import("./Test"));exportfunctionMyComponent(){consta=createAsync(async()=>{return{data: awaitgetData()};});return(<Suspense><Showwhen={a()}fallback={<div>Loading tierlist</div>}>{/* This will not render anything ⚠️ only the fallback */}{(a)=><TestClientOnlyfallback={"Fallback why?"}/>}{/* This will render Test ✅*/}{(a)=><Test/>}</Show></Suspense>);
I'm trying to use clientOnly component with data that comes from createAsync. It did not render the component - and it uses the fallback. But as I moved the cache and use server to a function in the same file - it did render.
Your environment 🌎
MacOS M1 Max, Node 22, pnpm, latest deps
The text was updated successfully, but these errors were encountered:
nirtamir2
changed the title
[Bug?]: clientOnly inside Suspense boundary with createAsync is not rendered
[Bug?]: clientOnly inside Suspense boundary with createAsync that uses server action and cache is not rendered
Nov 7, 2024
Duplicates
Latest version
Current behavior 😯
I added a stackblitz - it works there but on local env it won't work (and also not on a server).
It seems like we need to co-locate cache and use-server functions to the same file and we cannot split them.
When I declare my cache in a different file - it does not render clientOnly component.
https://stackblitz.com/edit/github-grada5-rgyttr?file=src%2Froutes%2Fabout.tsx
I'm using SolidStart and I'm trying to render component based on createAsync result. This component is wrapped with clientOnly - because it depends in the DOM.
It did not render this component.
Here is a small reproduction
server.ts
And inside
./Test.tsx
The result is that the TestClientOnly component does not rendered anything and goes into the fallback (if provided) to "Fallback why"
Expected behavior 🤔
The component will be shown and render (same as
<Test/>
)Steps to reproduce 🕹
And inside
./Test.tsx
Context 🔦
I'm trying to use
clientOnly
component with data that comes fromcreateAsync
. It did not render the component - and it uses the fallback. But as I moved the cache and use server to a function in the same file - it did render.Your environment 🌎
The text was updated successfully, but these errors were encountered: