SolidJS

S

SolidJS

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

Join

Solid start call

Just getting into solid start. Going through this documentation to try and get api routes set up so I can fetch data: https://docs.solidjs.com/solid-start/building-your-application/api-routes I have two files that look like this ```ts // src/routes/index.tsx...

Possible bug? Solidjs lazy() caches network errors

We are developing a smart tv app and as a part of checklist process there is a requirement that app should correctly handle network outages. The problem I discovered is that solid's lazy function caches TypeError: Failed to fetch dynamically imported module. I was not able to recover from this error in any way other than restart app completely - errorboundary reset not working. ...

Stuck On A Build Error

I've been stuck on the following build error all day. ```bash āš™ Preparing app for node-server... āœ” Generated public .output/public ...

NX setup with SolidJS and React

I have a monorepo where I create web components with SolidJS and take them into use in React. The app runs fine and individual libs builds ok, but I get error when I build React app: ``` libs\shared\ui\components\src\lib\tree\LoadableTreeAction.tsx:17:3 - error TS2322: Type 'import("C:/clients/node_modules/.pnpm/@types+react@18.3.18/nod e_modules/@types/react/jsx-runtime").JSX.Element' is not assignable to type 'import("C:/clients/node_modules/.pnpm/solid-js@1.9.5/node_modules/solid-js/types/jsx").JSX.Element'. 15 | props...

data is rendering correctly on file save but not on page refresh

I am unsure exactly what is happening but when I refresh the page using create resource no data loads. However if I save the file in my editor suddenly the data pops up. I am assuming this is an issue with SSR somehow, but I do not understand what I am doing wrong. ```typescript import { createEffect, createResource, Show } from "solid-js"; import { createExternalApi } from "~/server/externalApi";...

What's the most common way (or the idiomatic way) of refreshing access tokens in a Solid.js SPA?

In my mind, there's two ways to refresh an access token via a refresh token - (1) check when the access token is near expiry using a timeout and (2) when we fetch a resource, we check the access token if it's valid and refresh from there (or when we encounter a 401 on initial fetch). for scenario 2, how do we ensure that we're refreshing the token only once if there are 3 parallel requests that intend to refresh the token independently? it's also talked about here https://discord.com/channels/722131463138705510/722131463889223772/974342456990654486 for scenario 1, is there a primitive that allows us to check the validity across different tabs to avoid having multiple timers or avoid refreshing the token at the same time? sort of like shared process or a shared state. for now, i'm using the createPersisted primitive and localstorage, and have other tabs check for TOKEN_REFRESHING before refreshing. i'm wondering if there's a better way?...

Track down server dependencies in client

Some time in the past 24 hours all my server dependencies started showing up in the client, which has completely broken my project. Is there any way to track down exactly why these dependencies are getting included (e.g., which import statement)?

Can I use Solid for rendering DOM elements under non-Solid parts of the website?

I'm using ProseMirror in one Solid component. ProseMirror takes a div, adds it's own children and populates it with it's own DOM elements. For simple elements it's OK, but for more complicated, interactive elements it'd be advantageous to use SolidJS. But how can I make Solid rendered/controlled DOM elements under a non-Solid part of the website? ...

Show Loading

I'm trying to figure out how to show my loading spinner when the todo is streaming from the server: ```ts import { createAsync, query, RouteDefinition } from "@solidjs/router"; import { ErrorBoundary, Show } from "solid-js"; import { Loading } from "./loading";...

getTodo is not defined

I'm not doing anything special, but I can't load my todo: ```ts // routes/index.tsx import { createAsync, query, RouteDefinition } from "@solidjs/router";...

Where is @remult/solid

āžœ Local: http://localhost:3002/ āžœ Network: use --host to expose 8:48:35 p.m. [vite] (ssr) Error when evaluating SSR module $vinxi/handler/ssr: Cannot find module '@remult/solid' imported from ... ...

Flash Notifications

How can we display a success or failure message after a POST, which should not always be displayed at the form, but rather as a message on the page to which the request was redirected, preferably using a toast or even when redirecting? It could help when accessing protected routes, and you need to know why you can't access them.

Disable the nested store "feature"

Is there a way to disable the "feature" of parent stores reacting to changes of child stores. Its feels like an anti-feature to me and i cant seem to get around this in any good way.

Updating a signal depending on if an element is focused or not

I want to update a signal on whenever a element gains focus or not(true / false) ```jsx <input style={{'border-radius': borderRadius()}} class={styles["input-text-element"]}...

Correct way to import CSS used by 3rd-party library?

I am building a SPA where the registration page will make use of the Leaflet mapping library. I have installed Leaflet by running the command npm install leaflet. If I am only using Leaflet in the registration page, what is the correct way to import the Leaflet CSS file ("leaflet/dist/leaflet.css") and the Leaflet JS module?...

How to detect if I got to the Route with back button or navigate(-1)

Struggling with this one. I know I can probably use 'popstate' event but is there any solid-router approach?

Solid.js + tanstack/solid-query multiple refetch problem on error

Hi all, I'm using tanstack for client-server communication. And I'm turning the hook to createMemo if I want it to be re-mounted when I change query-params. But, for some reason, if such a hook receives an error from the server, it mounts infinitely many times. How to solve this problem?
No description

Server code in client bundle

Is there a way to stop a file from being in the client side bundle please? As seen in screenshot, I tried use server, this is a file that is outside of the routes folder btw, thanks!
No description

preload fonts in start

how to preload fonts like sveltekit? ```ts import type { Handle } from "@sveltejs/kit"; export const handle: Handle = async ({ event, resolve }) => {...

Best approach to having protected routes in SolidJs?

Hello, I'm working on securing certain routes in my application to ensure they are protected if a user is not logged in. There are about 10-15 pages that need to be restricted. I'm currently using Better-Auth for authentication and have switched to client-side rendering only for now.