SolidJS

S

SolidJS

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

Join

BUG?: clientOnly inside Suspense boundary is not shown

I'm using SolidStart and I'm trying to render component based on createAsync result. This component is wrapped with clientOnly - because it depends in the DOM. I did not understand why it did not render this component. Here is a small reproduction ```tsx...
No description

Is this a correct implementation? :)

I'm new to both JSX and Solid. Is this a correct implementation or can it be simplified? ``` const NavLink = (props) => { const [_, restProps] = splitProps(props, ["href", "children"]);...

pnpm and ffmpeg-static

Hi folks ! I am having an issue with node_modules-installed binaries. I am using ffmpeg-static and fluent-ffmpeg to do audio conversion with the SolidStart framework. When building my application with vinxi build, it seem to copy my root node_modules inside .output/server/node_modules, with everything, excepted the ffmpeg binary that I downloaded through the pnpm install command. Is there any workaround in order to get the ffmpeg copoied into it ? Or to get the actual path of ffmpeg binary ? Because the relative path I get from the ffmpeg-static module once ran contains the .output/server part, which is false. I could just remove that section from the path, but it looks like a dirty hack to get around this issue. Any thoughts ?...

How to Implement Page Caching

I’m developing an admin panel, and users will frequently navigate between different feature pages. If every page transition requires reloading data, it would lead to a very poor experience. Is there a way to cache the pages? For example, when a user switches back from route A to route B, they should still see the content as they left it, including the scroll position, data, etc.

Css modules not getting nonce attribute

I am setting up my app with a strict CSP header and passing the nonce in createHandler work as expected for all assets in the header. But I don't get the nonce attribute on <style /> elements that solid and/or vite injects into the body for a route's css module. does anyone maybe know how to solve this? or otherwise point me to the code in solid's repo where css modules are handled...

Nested Stores not tracking with `trackDeep`/`trackStore`

I have a top-level store created in parent component A. This store contains an array of objects, like so: ``` type MyType = { field1: boolean[],...

mutate & refetch not causing a re render

```tsx const [mainParentFolder] = createResource(folderPath, get_os_folder_by_path); const [osVideos, { mutate }] = createResource( () => mainParentFolder() ? mainParentFolder()?.path : null,...

Matching Error State with createAsync

When using createResource one has access to resource.error to handle the case when we get an error from our remote calls. ```tsx <Switch> <Match when={user.error}>...

SolidStart layout shifts using createAsync

Hi, I found out that I experience layout shifts whenever a createAsync is re-triggered. For example here: ```tsx...

pRPC - redirect not working in callers

When using the redirect$ function from prcp or the redirect function from solid-router it just does not redirect. ```ts export const redirectAction = createAction(async () => { throw redirect$("/hello");...

How to make setStore treat a class/interface as an opaque value instead of a partiable one?

So, I'm currently using a UOM library called @buge/ts-units. It has this interface called Quantity that I want to use in my stores. For example: ```ts type Rectangle = { // Length is an instance of Quanity // Length = Quantity<...>...

Reactive array transformation

What is the correct way to make the result of a filtering+mapping operation on an array reactive? ``` return store.productTreeData .filter(e => e.parentId == parentId) .map(e => {...

Display HTML entity

How can I display a text containing HTML entities? <div>{props.text}</div> displays the source code version of the entity. Thanks....

Re: Reset a store to its initial value, doesn't react

Hi, I'm trying to reset a store to its initial value, but when I do so the state doesn't react. The only way I can make it to work is to set each property of the store manually. ```tsx...

exporting css from solid-lib-starter

I am using solid-lib-starter as a template to build a library which exports components and one .css file. I can see it being present in the dist directory, but when I am using the library, vite says it cannot find that specificier for .css. Anyone knows how to handle this?...

CreateEffect and store properties

I have a store with a property xyz that is of type undefined | { a: number, b: number} and I ran into something I don't quite understand with createEffect. I pass store.xyz to a component as a prop and on changing the value, this triggers: ``` createEffect(() => {...

How to make use of <Suspense>

I have some code that I think might benefit from the Suspense component. I understand that for suspense to work the actual component being rendered needs to be asynchronous, but I don't understand how I can make the OsFolderCard async as the get_os_folders function returns all of them at once. If someone could explain how I could do that, or if it's even beneficial or not bcz of the way I fetch my data ```tsx export default function Dashboard() {...

`classList` does not seem to apply the classes on render

Here a reduced reproduction of the issue: https://playground.solidjs.com/anonymous/ba014c69-d95a-4e45-91cd-f95af6293f37 The issue: present should be underline. only when you click on past then present, then the classList is correctly applied ...

Reactivity with shadcn-solid textfield

I created my own NumberInput using https://shadcn-solid.com/docs/components/textfield. I see they have a number field, but I wanted the more typical html number input. My implementation has 4 number inputs that are clamped based on min/max values. I'm testing by manually typing -1 in the field. Technically a 1 and then I'm adding a - to it since it won't input otherwise. The clamp works for 2 of the inputs, but fails for the other 2. It seems to be losing the reactivity somehow. I've tried adding createMemo around the value to ensure the reactivity is present although I don't believe that shouldn't be necessary since I'm passing the accessor. I might see about creating a minimal example for this, but for now here's the code for the NumberInput and the implementation using is. ...

Bootstrap event handlers using on:* directive

I'm trying to handle the bootstrap dropdown events using the on:* directive. ```tsx <div class="dropdown"> <button...