SolidJS

S

SolidJS

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

Join

Page Refresh or Browser Button or ...

Good Day. I'm trying to figure out if a page has been reloaded or entered naturally via a link, etc. I've tried window.performance.getEntriesByType("navigation") but when I redirect via navigate('/page2') that api thinks the page was refreshed. ...

How to iterate over Object.entries()?

How does one use <index> or <for> together with Object.entries(obj) ``` function Example() { const [schema] = createSignal({'paths':{'/foo':{'a':'a'},'/bar':{'b':'b'}}})...

Help with Forward Ref and Ref from solid-primatives

I am still pretty new to solidjs and typescipt in general, i am trying to port a library from react to solid and am 90% of the way there - however i am having difficulties with using a forward Ref. There are two sections that are confusing me - that i would like help trying to solve.
Chart.tsx...

Updating only one property on an object

Hi, as I understand if one property of an object that is a signal updates, then all other properties will also rerun. It that correct? If yea is it because the object itself is dependent on its own properties so if one change the rest do. I have this as a simple example with style ```ts...

createRouteAction Form TypeScript

Why is she screaming at me?

using the callback to <Show> and update store, results in whole store being set to new value

<Show when={'companyName' in formDataStore && formDataStore}>
{(currentDataStore) => {
return (
<Show when={'companyName' in formDataStore && formDataStore}>
{(currentDataStore) => {
return (
...

Resource has wrong types?

Please take a look at this example: https://playground.solidjs.com/anonymous/1c0baf1f-20e7-4bc8-a878-6afe824ce4c1 In the createEffect, the type of shouldBeUndefinedButItsNot is number, but console writes undefined on first run. Am I misusing createResource?...

Where to protect SolidStart routes?

I tried layouts, but it loads data only once per page if I'm right, so if user gets logged out it doesn't react I tried middleware like in here https://start.solidjs.com/advanced/middleware, but it didn't re-load either, so am I doing something wrong (I'm not the sharpest tool) or is there a better way?...

Identifying multiple versions of Solid installed

I'm having a bit of trouble with a large app. I have a number of Solid dependencies and one of those is likely somehow pulling in a version that is not congruent with my main app (which is on 1.7.5+). I usually use the lockfile to track down the dependency issues but it's super cumbersome because I have a lot of various dependencies. The issue I'm seeing is when I launch my start app, I get the duplicate versions error. Wondering how other people would would approach the problem?...

html not rendering consistently inside span

onFocusOut={() => { const newText = document.getElementById(id)?.innerHTML updateNote(id, newText) }} ...

Can't get createServerData$ to work as expected

I have other projects that use routeData / createServerData$ / useRouteData that work fine. This one is giving me fits. In the below, trying to read the records() accessor gives me "records is not a function" ``` import { For } from 'solid-js' import { createServerData$ } from 'solid-start/server'...

Typesafe <Show> only when store has data

the end result I want ```jsx return ( <Show when={mockDataStore}>...

How to make the navbar change color when it's sticky like in the Solidjs homepage?

I only could come up with this. 400 is a fixed value for now, I should probably change it. Any suggestions? ``` const [bgColor, setBgColor] = createSignal(false); const changeBgColorHandler = () => { if (window.scrollY >= 400) {...

cant access global signals inside onMount?

Hello, I want to set a list of notes to contain the data inside an async fetch request. To do this, I want to fetch the data on page mount, then use that data to fill the notes signal. But, this is causing an error and I do not know why. The error message is "cannot access 'notes' before initialization", but I thought that the notes signal would be initialized first. Thank you

createResource does not working with json()

Why does text() work but json() does not: `` let [schema1] = createResource(async _ => await (await fetch(https://api.localhost/`)).json()); let [schema2] = createResource(async _ => await (await fetch(https://api.localhost/)).text())...

updating a tree of nodes in a SolidJS store

hey y'all. i'm trying to build a tree view where nodes have an isExpanded state i'm having a tough time trying to update the corresponding node. below is the approach i've tried but it doesn't trigger a component update for whatever reason. if there's a totally different way to do this, then i'm all ears ```typescript...

Navbar re-renders

Other than with solidjs, with solid-start using the "A" Component my Navbar reloading every time i click on a Link. How can i avoid this behavior?...

Problem with ref

Hi, I used to set ref like in this example, but it seems that when I use solidjs router, it doesn't work after unmounting and remounting the component (the ref return undefined). Is this normal behavior and should I use createEffect instead of onMount ?...

CreateStore types not work for array

const [store, setStore] = createStore([{
lotNumber: '',
}]);
const [store, setStore] = createStore([{
lotNumber: '',
}]);
...

Children helper break Context

I made a snippet to better show the problem, I tried looping the props.children instead of using the helper but it didn't really work https://playground.solidjs.com/anonymous/2ad2d60f-5f41-4a3b-abf5-6f9507c6c248...