Efkan
Explore posts from serversTTCTheo's Typesafe Cult
•Created by Efkan on 11/27/2023 in #questions
How to handle after form submit with Server Actions ?
Hello,
I'm looking for the best way to know the form is succesfully submitted and a succesful response returned.
I know about useFormState which works by passing an inital state and then updating the state in the server action.
But, here's the problem.
const [formState, formAction] = useFormState(editProvider, {success:null});
formState?.success // true after first response
Form submitted, success is true. If you submit the form again success is still true so the state isnt updated. I want to close the dialog when the success is true even after resubmissions. How I can handle this without disabling progressive enhancement ?
3 replies
TTCTheo's Typesafe Cult
•Created by Efkan on 10/13/2023 in #questions
Drizzle Schema Boolean
Hi everyone,
I'm trying to create a schema in Drizzle but my SQL knowledge is pretty limited.
I want to have a boolean like isProtected and if this is true then store some other information in other columns. I dont know how to handle a situation like this.
I want to have these
contentType
and contentUrl
columns to contain value only when isProtected
is true. Basically, Is there a way to make sure that when I set to isProtected
true Typescript will force me to add other related columns ?8 replies