remix-validated-form 4.6.9 → 4.6.11
Sign up to get free protection for your applications and to get access to all the features.
- package/.turbo/turbo-build.log +18 -18
- package/dist/index.cjs.js +5 -3
- package/dist/index.cjs.js.map +1 -1
- package/dist/index.esm.js +5 -3
- package/dist/index.esm.js.map +1 -1
- package/package.json +1 -1
- package/src/ValidatedForm.tsx +2 -3
- package/src/internal/hooks.ts +4 -1
package/package.json
CHANGED
package/src/ValidatedForm.tsx
CHANGED
@@ -321,7 +321,7 @@ export function ValidatedForm<DataType>({
|
|
321
321
|
startSubmit();
|
322
322
|
const submitter = nativeEvent.submitter as HTMLFormSubmitter | null;
|
323
323
|
const formMethod = (submitter?.formMethod as FormMethod) || method;
|
324
|
-
const formDataToValidate = getDataFromForm(
|
324
|
+
const formDataToValidate = getDataFromForm(target);
|
325
325
|
if (submitter?.name) {
|
326
326
|
formDataToValidate.append(submitter.name, submitter.value);
|
327
327
|
}
|
@@ -351,8 +351,7 @@ export function ValidatedForm<DataType>({
|
|
351
351
|
// but we already have the form in `formRef.current` so we can just use that.
|
352
352
|
// If we use `event.currentTarget` here, it will break because `currentTarget`
|
353
353
|
// will have changed since the start of the submission.
|
354
|
-
if (fetcher)
|
355
|
-
fetcher.submit(submitter || e.currentTarget, { method: formMethod });
|
354
|
+
if (fetcher) fetcher.submit(submitter || target, { method: formMethod });
|
356
355
|
else
|
357
356
|
submit(submitter || target, {
|
358
357
|
replace,
|
package/src/internal/hooks.ts
CHANGED
@@ -67,7 +67,10 @@ export const useDefaultValuesFromLoader = ({
|
|
67
67
|
// we should use the data from the deepest route.
|
68
68
|
const match = matches
|
69
69
|
.reverse()
|
70
|
-
.find(
|
70
|
+
.find(
|
71
|
+
(match) =>
|
72
|
+
match.data && typeof match.data === "object" && dataKey in match.data
|
73
|
+
);
|
71
74
|
return match?.data[dataKey];
|
72
75
|
}
|
73
76
|
|