Michael P. Jung
Michael P. Jung
SSolidJS
Created by Michael P. Jung on 4/14/2025 in #support
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>
So every time I start and stop the process another defunct esbuild process is created. I guess this really is a vinxi or vite issue. I just wanted to ask here if anyone else ran into this issue and knows a fix.
5 replies
SSolidJS
Created by Michael P. Jung on 2/11/2023 in #support
Testing code without a render function
I was writing some utility functions using SolidJS primitives and ran into the issue that memos don't update. This is the minimal vitest where I could reproduce the issue:
test('memo', () => {
createRoot(() => {
const [signal, setSignal] = createSignal(false)
const memo = createMemo(() => signal())
expect(memo()).eq(false)
setSignal(true)
expect(memo()).eq(true)
})
})
test('memo', () => {
createRoot(() => {
const [signal, setSignal] = createSignal(false)
const memo = createMemo(() => signal())
expect(memo()).eq(false)
setSignal(true)
expect(memo()).eq(true)
})
})
Am I missing something?
14 replies
SSolidJS
Created by Michael P. Jung on 2/1/2023 in #support
Accessing parts of a Store (sub store, substore)
I ran into some typing issue with stores. I've got a component that expects a data: T[] and setter: SetStoreFunction<T[]> . This is all fine when passing in a complete store as created by createStore(...) but breaks down if I want to pass a part around: e.g.
<Foo
data={store.foo}
setter={(...args) => setStore('foo', ...args)}
/>
<Foo
data={store.foo}
setter={(...args) => setStore('foo', ...args)}
/>
While this does indeed work at runtime TS goes bonkers about this as is doesn't know the type of args and I can't deduce anything due to the overload of the SetStoreFunction interface. fwiw. would be a helper like subStoreSetter(store, "foo") which returns that setter function so it could be used like that:
const setFoo = subStoreSetter(setStore, 'foo')
<Foo
data={store.foo}
setter={setFoo}
/>
const setFoo = subStoreSetter(setStore, 'foo')
<Foo
data={store.foo}
setter={setFoo}
/>
While we're at it that feature could also be a member of the setStore function which would look really nice API wise:
const setFoo = setStore.sub('foo')
const setFoo = setStore.sub('foo')
I don't know if this is even possible or if I should be replacing that one store object with multiple arrays into multiple stores one per array. Maybe that feature is still around somewhere and I'm just not seeing it. 🙈
7 replies
SSolidJS
Created by Michael P. Jung on 1/11/2023 in #support
How to access browser language during SSR?
In an SPA you would normally access navigator.language but during SSR the navigator is undefined. How can I access the browser language/locale during SSR?
18 replies
SSolidJS
Created by Michael P. Jung on 12/14/2022 in #support
ts-node not able to resolve ~ or node imports
I've got some scripts written in TypeScript in my project which I would like to execute. After some digging ts-node seams to be the obvious choice. However neither the ~ nor the import from node itself were working. After some digging I found that I can fix the node imports by either removing the types key from the tsconfig compilerOptions altogether or adding node to the array. Regarding the ~ paths however I'm stuck. I tried adding the tsconfig-paths package which doesn't seam to work at all, tried adding imports to the package.json and switching to a #root prefix instead. Nothing seams to help and I'm stuck with the annoying error message:
CustomError: Cannot find package '~' imported from /home/bikeshedder/projects/myproject/src/scripts/gen_schema.ts
CustomError: Cannot find package '~' imported from /home/bikeshedder/projects/myproject/src/scripts/gen_schema.ts
5 replies
SSolidJS
Created by Michael P. Jung on 12/9/2022 in #support
SSR Performance (SolidJS vs Next)
9 replies