You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have introduced conform & zod to my remix application.
In the login form i am returning a custom error uf the password or email was incorrect:
constsubmission=awaitparse(formData,{schema: (intent)=>schema.transform(async(data,ctx)=>{if(intent!=="submit")return{ ...data,user: null};constuser=awaitverifyLogin(data.email,data.password);if(!user){ctx.addIssue({path: ["password"],code: z.ZodIssueCode.custom,message: "Invalid username or password",});returnz.NEVER;}return{ ...data, user };}),async: true,});
I pass the error on the path: ["password"] as it is most likely that a user entered the password before submitting.
In that situation the problem also does not arise. But, if I were to add the it to path: ["email"] after the submission the email field would be refocused and the error immediatly disappearing (error flash, which is not readable). It then is hard to determine for the user what happened. Maybe they'll resubmit and the error would display but otherwise it just seemed that nothing happened but the field was refocused.
Has anyone else experienced this problem? I've not found related documentation.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
-
I have introduced conform & zod to my remix application.
In the login form i am returning a custom error uf the password or email was incorrect:
I pass the error on the
path: ["password"]
as it is most likely that a user entered the password before submitting.In that situation the problem also does not arise. But, if I were to add the it to
path: ["email"]
after the submission theemail
field would be refocused and the error immediatly disappearing (error flash, which is not readable). It then is hard to determine for the user what happened. Maybe they'll resubmit and the error would display but otherwise it just seemed that nothing happened but the field was refocused.Has anyone else experienced this problem? I've not found related documentation.
Beta Was this translation helpful? Give feedback.
All reactions