traches
traches
TTCTheo's Typesafe Cult
Created by traches on 2/11/2025 in #questions
Next-auth Session is null on initial render with useSuspenseQuery
// server component
export function ServerComponent() {
void trpc.procedure.prefetch()

return (
<Suspense><ClientComponent /></Suspense>
)
// server component
export function ServerComponent() {
void trpc.procedure.prefetch()

return (
<Suspense><ClientComponent /></Suspense>
)
'use client'

export function ClientComponent() {
const [data] = api.procedure.useSuspenseQuery()

return // stuff
}
'use client'

export function ClientComponent() {
const [data] = api.procedure.useSuspenseQuery()

return // stuff
}
And you have to prefetch every single suspense query, don't miss any
5 replies
TTCTheo's Typesafe Cult
Created by traches on 2/11/2025 in #questions
Next-auth Session is null on initial render with useSuspenseQuery
Update: I needed a suspense wrapper. I tried that previously, but there was another query deeper in the tree that also needed a prefetch. You have to have this structure:
5 replies
TTCTheo's Typesafe Cult
Created by traches on 2/11/2025 in #questions
Next-auth Session is null on initial render with useSuspenseQuery
Sorry, I missed that @conlonj25 posted basically the exact same issue a few days ago, but they didn't share a solution. I've tried wrapping the ArtefactView in a suspense container (inside page.tsx), but that didn't help.
5 replies
TTCTheo's Typesafe Cult
Created by traches on 10/20/2023 in #questions
Drizzle & Planetscale data migration workflow
I over-abstracted and added an association where I really only needed a boolean. Updating the schema is easy enough with db:push, but I also need to update all the existing records in prod - set new boolean column to the value of whatever the association is. That’s where my trouble was.
7 replies
TTCTheo's Typesafe Cult
Created by traches on 10/20/2023 in #questions
Drizzle & Planetscale data migration workflow
Update: I figured out a workaround: - Make a random schema change - run drizzle-kit generate, and since drizzle thinks a schema change is needed it will actually generate a SQL file - Discard said schema change - Replace generated SQL with whatever UPDATE statements I need - call drizzle's provided migrator function as appropriate - success Pretty sure ignoring the --custom flag is a bug, though. I've got an issue open on drizzle-kit's github about it (dont dox me pls)
7 replies