FutureLights
Explore posts from serversSolid Start with Prisma, when making changes to pages results in routing to 404 page.
I just started playing around with Solid Start and am using the Prisma template. I can spin it up just fine by generating the Prisma db with
npx prisma generate
and then starting the dev server with npm run dev -- --open
. Everything works great. However, I'm having issues with the simpliest of things. If I go into the login form page and add a div element, the entire project breaks. Now instead of seeing a login page when at /login
it fashes quickly and then I get the 404 error page. Interestingly, I can edit the names of the fields and that works, it's just when I try to add a new element.
Why is this simple change breaking the project? This is really my first time working with SSR and Prisma for that matter, however I am pretty comfortable using Solid JS. Is there something I am missing? I've tried completely restarting the dev server incase it's an issue with the HMR, but I still get the same behavior.1 replies
Wrap each child
I would like to wrap each child in an element.
For example I have a list element and I wand ever child element to be wrapped in a
li
element. What's the proper way of doing this? I can do it like this with the children
helper function, but is this a good way of doing it? Should I try to avoid this situation?
11 replies
Solid JS force rerender on signal change
I need to force Solid JS to make changes to the DOM every time a signal changes. Currently it seems that it is batched, probably for performance reasons. I can get around this by wrapping my second signal change in a
setTimeout
, but I want to make sure I am not implementing a hacky solution. For example, could I reliably get away with using a requestAnimationFrame
or is there some Solid JS provided function that I missed?
Here is a code snippet that demonstrates the problem and the timeout fix. If you remove the setTimeout
, you will see no change.
4 replies
Context In Typescript
I'm trying to create a context in Typescript following this example, but copying and pasting the code results in an error when I try and use the
ThemeContext.Provider
in the ThemeProvider
Component.
https://www.solidjs.com/examples/context
Cannot find namespace 'ThemeContext'.
Any suggestions?20 replies
Better way of reusing event listeners for hooks
I have a hook for the window size.
It works great, but I want to reuse my event listener because I'll be using this hook in many components. I can always do something like below, but there has to be a better way to do it with something that SolidJS provids? Or even JS.
4 replies
EPERM operation not permitted, rmdir
I'm getting this error when I try to visit my dev site
I'm pretty sure I somehow corrupted by project. The Vite HMR wasn't working and I was trying to fix it. I did not change any config files, just tried starting vite with different flags. Anyways, if I look at my
node_modules
folder properties, the read-only checkbox is checked (Windows). Unchecking shows a progress bar and closes, but it is still checked if I reopen properties again. Googling hasn't helped (https://stackoverflow.com/questions/39293636/npm-err-error-eperm-operation-not-permitted-rename, https://stackoverflow.com/questions/58078937/eperm-operation-not-permitted-mkdir-c-program-files-nodejs-node-modules-sta).
I've never had this problem with React, but I have several times with Solid JS. I'm sure it nothing with Solid JS, I just don't know if it's an issue with vite or something else. I'm sure it's something I did wrong, but have no idea what or how to fix it. If anyone has ran into this problem, and has a solution that would be great. As of now, my only work around is to delete node_modules
and package-lock.json
and reinstall everything. I really don't know why that works and I have to redo everytime any of my packages change.11 replies