SolidJSS
SolidJS15mo ago
3 replies
nirtamir2

BUG?: clientOnly inside Suspense boundary is not shown

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.
I did not understand why it did not render this component.
Here is a small reproduction

import Test from "./Test";

const TestClientOnly = clientOnly(() => import("./Test"));

export function MyComponent() {
  const a = createAsync(async () => {
    return { data: await getData() };
  });
  return (
    <Suspense>
      <Show when={a()} fallback={<div>Loading tierlist</div>}>
        {/*  This will not render anything ⚠️ only the fallback */}
        {(a) => <TestClientOnly fallback={"Fallback why?"}/>}
        {/*  This will render Test ✅*/}
        {(a) => <Test />}
      </Show>
    </Suspense>
  );


And inside ./Test.tsx
export default function Test(){
    return <div>Test</div>;
}
image.png
Was this page helpful?