remix-validated-form 4.6.3 → 4.6.4
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +7 -7
- package/browser/internal/flatten.js +1 -1
- package/browser/internal/hooks.js +1 -1
- package/browser/internal/state/arrayUtil.js +16 -2
- package/browser/internal/state/createFormStore.js +1 -1
- package/dist/remix-validated-form.cjs.js +1 -1
- package/dist/remix-validated-form.cjs.js.map +1 -1
- package/dist/remix-validated-form.es.js +3 -1
- package/dist/remix-validated-form.es.js.map +1 -1
- package/dist/remix-validated-form.umd.js +1 -1
- package/dist/remix-validated-form.umd.js.map +1 -1
- package/package.json +1 -1
- package/src/internal/state/arrayUtil.ts +16 -1
- package/stats.html +1 -1
package/package.json
CHANGED
@@ -105,7 +105,9 @@ export const mutateAsArray = (
|
|
105
105
|
const newKeys = getDeepArrayPaths(arr);
|
106
106
|
for (const key of newKeys) {
|
107
107
|
const val = getPath(arr, key);
|
108
|
-
|
108
|
+
if (val !== undefined) {
|
109
|
+
obj[`${field}${key}`] = val;
|
110
|
+
}
|
109
111
|
}
|
110
112
|
};
|
111
113
|
|
@@ -354,6 +356,19 @@ if (import.meta.vitest) {
|
|
354
356
|
});
|
355
357
|
});
|
356
358
|
|
359
|
+
it("should not create keys for `undefined`", () => {
|
360
|
+
const values = {
|
361
|
+
"myField[0]": "foo",
|
362
|
+
};
|
363
|
+
mutateAsArray("myField", values, (arr) => {
|
364
|
+
arr.unshift(undefined);
|
365
|
+
});
|
366
|
+
expect(Object.keys(values)).toHaveLength(1);
|
367
|
+
expect(values).toEqual({
|
368
|
+
"myField[1]": "foo",
|
369
|
+
});
|
370
|
+
});
|
371
|
+
|
357
372
|
it("should handle remove", () => {
|
358
373
|
const values = {
|
359
374
|
myField: "something",
|