SolidJS

S

SolidJS

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

Join

Preferred way of handling `429 Too Many Requests` with `createResource`?

I have an API that returns 429 with a retry-after header. The way I handle it right now seems... suboptimal to me. It works fine, don't get me wrong, but I have a feeling it culd be handled better. ```ts const [canLoad, setCanLoad] = createSignal(true); const loadQuote = async () => {...

Passing signal value as a prop

Hey, I just started learning solid today and I'm already having some troubles with it. I'm trying to create a quick project overview carousel, but for some reason, title won't update. The only thing that "somehow" worked, was to call signal getter inside Title component, but its kinda now what i'm looking for. Title.tsx ```tsx import { JSX } from 'solid-js';...

solid-primitives/storage help for a persistent user config store not loading properly on refresh/

I have user config in a store that I want to persist. I added makePersisted from solid-primitives/storage 4.3.1. I do a check for if it is the first time the user has visited to give initial config. I load the components based on each config item in the store array. When I refresh the page, the UI does not reflect values from localStorage; it loads the same as first initialized. When I make a config change, one div "catches up" (the For with Show), but the other one doesn't load the correct value until I re-toggled them myself. I've tried a resource from init tied to Suspense or even Show. Any help appreciated. `import { makePersisted } from "@solid-primitives/storage"; export default function Home() {...

Solid Start in pnpm workspaces monorepo

Hi, does anyone know how to make solidstart work in a monorepo with pnpm workspaces ? After seeing the section talking about monorepo support on solidstart readme, I tried this in pnpm-workspace.yaml: ```yaml shamefullyHoist: true...

Stale read in <List><Show><List>

https://playground.solidjs.com/anonymous/ccb906d4-c9f1-437f-9f72-e94279b0e25d I am stumped, I don't know why the stale read is happening, I don't know why it's triggered by that stream of states and not others. Note that the playground doesn't render the error message correctly, here's the dev message:...

Untrack on store arrays

Yesterday I had some misunderstandings around createEffect and stores. Today I probably have similar misunderstandings around untrack. My assumption was that, e.g. ``` createEffect(() => {...

createEffect vs createEffect + on

What could be the reason that the first createEffect is triggered but not the second one using on? I feel there is something obvious I'm missing. Using solid-js 1.9.5 ``` createEffect(() => { console.log("effect", props.nearestPointConfig);...

SolidJS Router Missunderstanding

Can someone help me setup a basic router with the "@solidjs/router" I am not sure where to put what. My current understanding was that this is the way to do but document.getElementById is underlined red: ``` Argument of type 'HTMLElement | null' is not assignable to parameter of type 'MountableElement'....

Clearing form after action in solid-start

Searches on this discord return old posts that suggest using createEffect on submission.pending along with a ref to the form to do clearing. I'm just checking if this is still the right way to handle form clearing after successful actions. Please let me know if you have a better suggestion. Thanks...

Would this break reactivity?

I'm new to signals. The solidstart tutorial mentioned that destructuring may break reactivity in components. I don't fully understand that just yet and wonder if that means the following hook would break reactivity. This is a convenience hook I'm writing to simplify usage of the better-auth useSession hook. If it can potentially break reactivty, how would you suggest accomplishing the goal of unpacking the data field into user and session? ```...

Multi Layout Children

Is it possible for a page to set some data to go into different layout locations, like named slots for children please?

Getting Page Title

If this is in a route: <Title>Example 🧘‍♀️</Title> Is there anyway to get that information in the Layout of that route please? I figured I could hack like an onMount + js thing but wondering if server side in the layout i could know this info w/ Solid's api please?...

State Doesn't Get Defaulted And Values Don't Change

So i am making a reactive state system where the developer of a component can supply a default state and other states if they want. The default state is used when nothing is active and regarding the states. The code checks on the array to say which is active, the way the state array is orchestrated, it uses the first active state present in the list Each state has specific values to it, like color & other stuff. The STATE DEFAULTING EFFECT gets triggered and correctly switches the state. However the STATE DEFAULTING MEMO is not triggered. For some reason when i get the style field, even tho it does supply the correct value. The values do not get updated For context getterFromReactive "normalizes" the values into just accessors. It does create a effect for checking whenever the value is changed or not and update the returned value accordingly...

Need help understanding preload and file conventions

Hello guys, I started with SolidStart and want to fetch data before rendering the page, So I found preload here https://docs.solidjs.com/solid-start/building-your-application/routing#additional-route-config and started with ```tsx import { RouteDefinition } from "@solidjs/router";...

Cannot run React alongside SolidJS in Astro

The Error:
[vite] The requested module 'solid-js/jsx-dev-runtime' does not provide an export named 'jsxDEV'
[vite] The requested module 'solid-js/jsx-dev-runtime' does not provide an export named 'jsxDEV'
My Astro Config:...

Killing `pnpm dev` results in a defunct `esbuild` process

I've created a fresh solid start project with the default template. I noticed that pressing Ctrl+C causes a esbuild process to linger around in the defunct state.
11169 pts/1 Z 0:00 [esbuild] <defunct>
11169 pts/1 Z 0:00 [esbuild] <defunct>
...

Can't install or get a project started using SolidJs

I've checked some info from all available leads to resolve this but can't get a clear cut answer leading me to believe the issue is from my end but I don't know how to fix is. I've tried: upgrading bun clearing cache using npm...
No description

Why are both class and classList needed?

Hi, I just went through the tutorial on solidjs website. I'm hoping to understand the rationale between having both class and classList instead of combining their functionalities into just class. Thank you for any pointer you can provide!...

Solid Start Internal Fetch

Is there official or unofficial/hacky support for internal fetch at this point? The docs still mention it being passed to API route handlers but I'm not seeing that being the case (anymore?). Anyone figured out a working even hacky solution, directly calling Nitro internals or anything? (I sent this originally in #solidstart but realized this was probably the proper place for it)...
Next