Isaiah Smith
Isaiah Smith
DTDrizzle Team
Created by joostschuur on 2/13/2024 in #help
Using Drizzle SQLite in a Next.js server component gives error that suggests client side execution
No problem, glad I was able to help!
26 replies
DTDrizzle Team
Created by joostschuur on 2/13/2024 in #help
Using Drizzle SQLite in a Next.js server component gives error that suggests client side execution
26 replies
DTDrizzle Team
Created by joostschuur on 2/13/2024 in #help
Using Drizzle SQLite in a Next.js server component gives error that suggests client side execution
In either case, the reason youre running into the error and what you want to avoid/be aware of is importing what should be server-only running code into a client component. There are ways to do it (such as with server actions and "use server", but for most situations you can avoid it by refactoring your components / data-fetching. Happy to try and explain things a bit more if you're still running into issues but I also think the next docs might be a good place to learn recommended patterns too!
26 replies
DTDrizzle Team
Created by joostschuur on 2/13/2024 in #help
Using Drizzle SQLite in a Next.js server component gives error that suggests client side execution
A second way to handle this might be to fetch data in the "page" server component and then pass it to other components via props to handle the display logic (NOTE: data can be passed to either server components OR client components so long as it’s serializable) - Example: https://github.com/jschuur/drizzle-turso-test/pull/2
26 replies
DTDrizzle Team
Created by joostschuur on 2/13/2024 in #help
Using Drizzle SQLite in a Next.js server component gives error that suggests client side execution
Assuming in your actual project you might have some "client" code you're trying to run on the page, and just want to inject some "server" code somewhere, 1 approach is to use composition to put the server component inside the client component - Example: https://github.com/jschuur/drizzle-turso-test/pull/1
26 replies
DTDrizzle Team
Created by joostschuur on 2/13/2024 in #help
Using Drizzle SQLite in a Next.js server component gives error that suggests client side execution
When you import a “server” component into a “client” components file, you essentially cross over the threshold into “client”-land from that point on (in the import tree) and any code imported is then bundled up and also run on the client. The reason removing “use client” fixes things is because it removes the “client”-land transition and keeps your code running on the server only (which seems like what you want?)
26 replies
DTDrizzle Team
Created by joostschuur on 2/13/2024 in #help
Using Drizzle SQLite in a Next.js server component gives error that suggests client side execution
Hey @joostschuur, so I think this might be more due to confusion around client and server components
26 replies
DTDrizzle Team
Created by Tommy Misikoff on 1/1/2024 in #help
Drizzle Queries in Drizzle Studio
No description
2 replies
DTDrizzle Team
Created by Isaiah Smith on 1/6/2024 in #help
Help understanding "--> statement-breakpoint"
Ok, cool. That sort of makes sense. If thats the case though, I'm wondering if maybe the docs should be updated to say you may need them for DML commands as well? I imagine others have/may run into this hiccup if they ever run the drizzle-kit generate:sqlite --custom command?
4 replies