dohn
Explore posts from serversWhat's the correct way to wrap server functions?
I have a bunch of duplicate authentication and validation logic in my server functions that I'd like to extract to a utility like
createAuthenticatedAction
that authenticates the user before running the server callback passed to it, but every time I create any wrapper around "use server" the compiler stats complaining. Where should I put a "use server" directive if I only want this helper to run on the server?8 replies
Do something when a submission ends if there's more than 1 action
Hey everyone. For showing user feedback (like a toast) when an action was done I was checking the
action.result
inside a createEffect
where action
is the returned value from useSubmission(myAction)
This has been working fine but breaks the moment I use more than one useSubmission
in the same component. All effects run on success even if just one action was fired (in my case showing multiple toasts)
What's the pattern for handling this?13 replies
How to come up with reproductions for production-only Nuxt crashes?
We're having quite a few Sentry alerts in production due to stuff like manifest errors (similar to https://github.com/nuxt/nuxt/issues/25977) or failed CSS preloading, but we currently can't provide repros as there are way to many modules in the project and these errors are very obscure. What's the approach for debugging them and maybe be able to get a repro?
3 replies
DTDrizzle Team
•Created by dohn on 10/17/2023 in #help
PostgresError: unrecognized configuration parameter "schema"
Hi everyone. I'm migrating a pretty large app from Prisma to Drizzle and its been great so far, but I'm having problems with my seed script:
When I run it it says:
PostgresError: unrecognized configuration parameter "schema"
The schema
object is a re-export of all database models1 replies
DTDrizzle Team
•Created by dohn on 6/11/2023 in #help
Best way to run safe raw queries when only having access to the table name?
Hey I'm working a Drizzle adapter for a library. The Adapter API only has access to the
db
Drizzle instance and the table name, what's the best way to perform a SELECT * FROM table
given only those two parameters? The sql
operator works by passing not the table name, but the schema (which I dont have access to) so I tried sql.raw
but it doesn't escape variables. I could escape them manually, but maybe there's an easier/better way.1 replies