jotai-form
jotai-form copied to clipboard
input starts dirty when hydrated
If I have an atom defined like this
export const nameAtom = atomWithValidate("", {
validate: (name) => {
try {
name.parse(name);
return name;
} catch (err: any) {
throw err.issues;
}
},
});
and hydrate it via
useHydrateAtoms([[nameAtom, "hello world"]);
the input will start as dirty, since "hello world" !== "". If an atom is hydrated, what it is hydrated with should be the initial value that is checked against to determine if the input is dirty or not.