Bersaelor
Cache-Busting with solid.js
I have a CSR SPA, where the contents sit in static webstorage and the solid.js site is rendered on the client side. E.g.:
My CI will build the site when changes are made to the
main
branch, and replace the contents of the S3 folder.
When that happens I also invalidate the cloudfront-cache, so all future requests go at least once to the newly update files and aren't served by cloudfront.
BUT: There also seems to be some browser-caching going on, i.e. sometimes, after an update of my site, if I switch to a tab I had open of the solid-js SPA, I will get an unknown client error
and some import problem of the _build/assets/filename-CRYkDoFJ.js
where it tries to load one of the old ***-<id>.js
build artifacts.
Do any of you have experience preventing this?
(I don't want my users to have to refresh their browsers if they have our site open in a tab and happen to come back to it after a few days away)19 replies
importing static assets (telling vinxi/vite about stuff other then png's)
Every other month, I feel like i'm facing this again.
How to import static assets in solidjs?
The docs https://docs.solidjs.com/solid-start/building-your-application/static-assets say:
Vite provides a way to import assets directly into your Solid components:If I try the same with other stuff like
*.svg
or *.txt
the import fails.
I did have a an older solidjs project where I could do
In the old project I did this via
Is there a way we can still do this with solidjs/start
? Since we don't have a vite.config
anymore?14 replies
Ideas what could cause static assets from failing to import?
fails with
`Cannot find module './test.png' or its corresponding type declarations.This with
"solid-js": "^1.8.17",
and "@solidjs/start": "^1.0.0",
.
If I create a new project with npm create solid
I can import the test img, trying to pinpoint what could cause my project to fail importing it.
app.config.ts
:
9 replies
Is anyone detecting light vs dark mode on their site>
For example, I frequently use
when I need my logic to work different on mobile devices.
Now
is just never positive?
(this is using the
useMediaQuery
from https://suid.io/components/use-media-query )4 replies
`vinxi build` fails with RollupError during unecessary "Preparing app for node-server... "
Hey there,
so when I run
npm run build
which really runs vinxi build
as of solid 0.4.* it works locally.
But when run as part of a github action, it fails with
So, this seems to happend AFTER the .output/public
folder is created, the next step is Initializing prerenderer
.
But I'm not using any node-server, how can I tell it that it doesn't have to do that during CI steps?23 replies
Plain string for <Link onload="..."> shows warning
I want to preload google fonts in the
root.tsx
like so:
yet, typescript can't seem to find that attribute, i.e.:
Type '{ rel: string; href: string; as: "style"; "attr:onload": string; }' is not assignable to type 'IntrinsicAttributes & LinkHTMLAttributes<HTMLLinkElement>'. Property 'attr:onload' does not exist on type 'IntrinsicAttributes & LinkHTMLAttributes<HTMLLinkElement>'How can I use
attr:
to make clear I want to set my attribute as plain text?33 replies
solid-eslint warning about event handlers
So, I get the
eslintsolid/reactivity
warning when I use reactive props in event handlers:
This function should be passed to a tracked scope (like createEffect) or an event handler because it contains reactivity, or else changes will be ignored.How else would you all handle this?
18 replies
Suspense doesn't seem to work with ContextProvider
hey, so recently I noticed,
If I use
createResource(fetch)
and then put <Suspense fallback={<Placeholder>}>
I will see the placeholder during loading.
But if I have createResource(fetch)
inside a ContextProvider, i.e.:
and then have a
then I will not see the suspense-placeholder and in fact my UI will not update until the data is loaded.
Does suspense & createResource
not work around context-provide and use
?5 replies
`<A>` from `solid-start` is slow on Android. How to debug performance?
So, on my detail page I have a button
```jsx
import { A } from 'solid-start';
const Detail = () => {
return (
// ...
<A href='/'>
//...
}
When I press that button on my Samsung S9 (not the slowest of android phones), it feels like a second before anything happens and I see the home screen again.
How can I speed this up? How can I debug what is causing the delay?
10 replies
Context is undefined during development reloads
So I use a few contexts like:
this worked fine for a while now, since I make sure to always wrap components that use it into the correct providers.
For about a week now, when using
npm run dev
when I make small changes ot my code (just a linebreak for example) and save, my browser running localhost:3000
will have a:
I then have to manually reload the page in the browser to see the change. This is a little annoying since I like to see visual layout changes immedieately on my second screen while I adjust the code, now I always have to mouse over to reload the page.
What could be causing this? I mean it all runs perfectly well as a whole site, just the little live updates break it?5 replies
solid-start: How to import browser-only depencency
I'm trying to include a browser-only dependency into a solid-start project that is partly server-side rendered.
I.e. my vite.config:
Now after doing the usual
npm install rudder-sdk-js
, when I do npm run dev
, I get:
70 replies
Make createMemo depend on unmentioned signal
I have a
createMemo
that depends on a list of objects
now, when I reorder that list of objects, the createMemo does not fire again, since I guess the content staid the same.
Now I defined
that I increment each time I reorder the list.
Short of
how do I make sure it refires? Making logic depend on console.log
feels dirty.23 replies
Favorite way of dealing with typescripts `!`-forbidden warnings
For example, I often do:
I know my code is wrapped in an
AuthContextProvider
, and I want it to crash/error out in case I ever miss the context provider.
How do you tell typescript-eslint to shut up about these cases?5 replies
How to get `useParams` in the "root.tsx" in a server-rendered-page.
Inside the
root.tsx
before any FileRoutes
are resolved, how can we get the full path / the params for the current html-request?
When I use useParams().id
inside the root.tsx
, I always get undefined
.3 replies