SolidJS

S

SolidJS

Solid is a declarative reactive Javascript library for creating user interfaces.

Join

How to detect if I got to the Route with back button or navigate(-1)

Struggling with this one. I know I can probably use 'popstate' event but is there any solid-router approach?

Solid.js + tanstack/solid-query multiple refetch problem on error

Hi all, I'm using tanstack for client-server communication. And I'm turning the hook to createMemo if I want it to be re-mounted when I change query-params. But, for some reason, if such a hook receives an error from the server, it mounts infinitely many times. How to solve this problem?
No description

Server code in client bundle

Is there a way to stop a file from being in the client side bundle please? As seen in screenshot, I tried use server, this is a file that is outside of the routes folder btw, thanks!
No description

preload fonts in start

how to preload fonts like sveltekit? ```ts import type { Handle } from "@sveltejs/kit"; export const handle: Handle = async ({ event, resolve }) => {...

Best approach to having protected routes in SolidJs?

Hello, I'm working on securing certain routes in my application to ensure they are protected if a user is not logged in. There are about 10-15 pages that need to be restricted. I'm currently using Better-Auth for authentication and have switched to client-side rendering only for now.

Special characters in server function error may crash app

Can someone verify this please? I could not get my version of Firefox to work with stackblitz, but I see this in two different versions of chromium.
Observe that navigating back and forth ("About" / "Index") works, then uncomment the throw error with special characters in the string, then try navigating back and forth. reproduction...

API w/o File Routes Component Possible?!

Are there any ways to create api routes w/o using the file routes component please? Like a way to specify a url path in the code and not via the file name please? Thanks!

How to trigger focus and scroll across the app?

What is the best way to trigger DOM element related reactions across the app? By across I mean for example by keyboard, related to a different component, etc. In practice, there is a global store, where you want to have a function focus() or scrollToBottom() etc. My current idea is to have a large, random integer in a variable in the store, and in the component rendering the DOM element I just put a dummy createEffect() with this integer and a scroll/focus effect....

Clarification on createAsync and Suspense behavior

i have an async data which relies on params id and offset. id is the slug of the page (location.params.id) while offset is just a signal. the async data is wrapped by a Suspense component with a fallback....

Layouts w/ Component Rendering please?!

How may we group routes w/o a common path while using component rendering please? Below I tried not putting a path for the layout components but when I test this the app is a white screen & the server terminal says 'No route matched for preloading js assets". If I add a path for each layout this works but then the url has to be example: /guest/sign-in but the goal is for the url to be /sign-in and for the layout to be Guest w/ component rendering please! ``` import { Suspense } from 'solid-js' import { MetaProvider } from '@solidjs/meta'...

Solid router, suspense and navigate

<Router root={<App>{props.children}</App>}>
{routes}
</Router>
<Router root={<App>{props.children}</App>}>
{routes}
</Router>
...

Deploy SolidStart with cluster?

I've completed development with SolidStart. Currently, I need to deploy it to my vps. So I'm wondering about performance and want to deploy solid-start application with cluster mode. I've to trying the nitro preset for node-cluster with full app.config.ts ```typescript import { defineConfig } from "@solidjs/start/config"; import tailwindcss from "@tailwindcss/vite";...

Astro/Solidjs

Greetings! How could I encapsulate this logic so I could use it in multiple components? It would be similar to using React custom hooks. I tried to do it in a normal FN, but it didn't work as expected.
No description

useNavigate to set search params

Whats the preferred way to set search params from useNavigate. I was thinking navigate("/path?foo=" + bar) but this feels wrong.

onCleanup is running on server

When I put client side code in an onCleanup & then refresh the page the server crashes b/c it's trying to run the client side code on the server, super simple repo is: 1. npm create solid > Solid Start > Basic > TS 2. swap index.tsx for this: ...

How to Abstract Routers using Classes

I'm trying to create a library that leverages a subset of routing functions under the hood. With the release of TanStack Router for SolidJS, I do not want to couple the library specifically to Solid Router and want to provide a Router abstraction that consumers of the library can configure with their router of choice. The way I'm going about that is providing abstract Router classes. Below is one example: ```tsx import { type Accessor, createSignal } from "solid-js"; ...

Correct type for props.children?

I have wrapper component that wraps an <input> in one component and a <select> in another component. It takese these props: type Props = {...

SSR doesn't auto fetching data when CSR

Hi, Currently, I've create some routes for SSR purpose and they work perfectly. However, If I go to the page SSR then navigating through some page and back to the SSR page the data SSR before is loss. ```typescript...

Solid-Start error when using fetch/axios/ky to call to external service SSR

Hi I'm new at Solid-Start. Currently, I'd like to call to external API. I try to use all of fetch/axios/ky but all of them returned error. For detail: 1. If I call API inside onMount() it can work as normal. ...
Next