S
SolidJS10mo ago
ish

Solid Start: CSR Only Page

I have one page that is very interactive and if client side rendering is not available I'd like to display a page along the lines of "javascript is required". I tried wrapping it in <ClientOnly> but that still comes out in the SSR content. Part of this is based on my bringing over the component from SolidJS and various browser only APIs are used. Thanks.
3 Replies
ish
ish10mo ago
This almost gets me here..
const PcapUpload = unstable_clientOnly(() => import("~/components/PcapUpload"));

export default function Upload() {
return (
<>
<PcapUpload
fallback={<>This page requires a browser with JavaScript</>}
/>
</>
);
}
const PcapUpload = unstable_clientOnly(() => import("~/components/PcapUpload"));

export default function Upload() {
return (
<>
<PcapUpload
fallback={<>This page requires a browser with JavaScript</>}
/>
</>
);
}
However, if this is the first route the user goes to in the browser the fallback is display, and never goes away.
ish
ish10mo ago
Thanks. That and a noscript tag got me the desired effect.