SolidJS

S

SolidJS

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

Join

Best practice working with reactive values inside context provider

I did some experiments using solidjs context. Context as value is not reactive in solid.js. It's a little different from props that are reactive - if you pass signals as props like a={a()} to Child, and access props.a - a is reactive. If I wrap the context value in a function and treat context as Accessor<OriginalContextValue> - it's reactive. If I use a store it's reactive too (but the update needs to be done differently)....

Trigger same API call with different payloads in parallel using CreateResource

I am facing issues with making same API call multiple times with different payloads (using ForEach). I am setting a payload within the store at each iteration and that store proxy is used as a dependency of fetcher function inside createResource export const TriggerAPI = () => { const [dummy] = createResource(getPayload, fetcher); return dummy; };...

esm.sh & router

Hi all, Trying to get solid's router working with esm.sh and SSR in Deno. I've created an issue with esm.sh to support conditionals, but in the meantime does anyone have an idea besides manually bundling for the server? https://github.com/ije/esm.sh/issues/511 ...

Subscribe to

Given the derive signal feedback
const [store, setStore] = createStore({fb: [0,1,2]});
const feedback = store.fb;
const [store, setStore] = createStore({fb: [0,1,2]});
const feedback = store.fb;
...

Strange React not defined error

I've created the bare minimum solidjs + vite app with just and index.html and index.jsx page: ``` import { render } from "solid-js/web"; ...

I get `Invalid left-hand side in assignment expression.` when I assign a value.

I get the error above if I try to assign a value to selectedRate inside the onClick even with the arrow function removed, I still get an error. ```jsx const ratings = [1, 2, 3, 4, 5];...

For component not displaying values

What am I doing wrong here?? ```jsx import { For } from "solid-js"; ...

Component is called twice when using Suspense, createResource and solid router

Hi I have a component that uses createResource. When navigating to a route containing this component, it's called (reevaluated?) twice. Is this what is supposed to happen when using transitions (which the router is using)? Or is it a bug? Is there some documentation for how Suspense is supposed to work? I can try to create a self-contained example if that makes it easier to understand my issue 🙂...

Handling locale dates when SSR

I am trying to display a date with date.toLocaleDateString, however as the page is SSR it is instead showing as the server's locale. Is there a pattern to handle this?

Calling database with server actions in Solid Start

Hey all, I have a question more about best practices than anything. In the Solid Start docs, under the Server Actions heading, it says the following:
Or even connecting directly to a database. (Take caution, opinions on if this is a good idea are mixed. You should consider separating your backend and frontend).
Or even connecting directly to a database. (Take caution, opinions on if this is a good idea are mixed. You should consider separating your backend and frontend).
My question is why this may be considered a bad idea, especially when it's not frowned upon in createServerData$....

ReactiveMap

I am having an issue with reactive map - i think i know why it's happening but i have no idea how to fix it. I have the below code
Setting up the Store (static map just for testing)
```ts...

Using renderToString in node

I have a file that looks roughly like this: ``` import { renderToString } from "solid-js/web" ......

styles.map.css is a route param for some reason

Hi all -- seeing this issue inside of a routeData function. ``` const routeData = ({ params }) => { return createServerData$(...

Unknown file extension ".ts" for rollup.config.ts

I'm using solidjs-community/solid-lib-starter and I'm getting this error. Any help?

Map return from createServerData

``` return createServerData$( async ([params]) => { const collectionMap = new Map(); const data= await xxx;...

Tauri

Alright, i decided to crate a suppport thread for this -as i have multiple questions. For starters i have migrated the app and the router from solid-start to solidjs with success. All of the previous issues i mentioned are now solved and working as expected. I have a new issue, two in fact. One major and one minor. ...

Argument of type 'string' is not assignable to parameter of type 'never'.

When using setState in a provider I get this error since the new update, is there any way to fix it ? Argument of type 'string' is not assignable to parameter of type 'never'....

Accessing cookies in routeData()

Is there any method to access cookies within createRouteData within routeData?

Testing SolidStart routes with Vitest

Hello! I'm using SolidStart and Vitest to test the components. But I didn't manage to find a way to test the route files (such as the index.tsx in my route folders, or the dynamic ones [id].tsx for example). I'm putting my test files.test.tsx next to the tested files, and the route ones kinda broke my app's routes. Do I necessarily have to move them somewhere else? And then, any idea on how I should render and test my routes? Does anyone has an example of good practices to test a SolidStart route? ...