@conform-to/dom
Advanced tools
Comparing version 1.0.4 to 1.0.5
13
form.js
@@ -120,3 +120,8 @@ 'use strict'; | ||
meta.key = util.clone(meta.key); | ||
submission.setListState(meta.key, intent, util.generateId); | ||
submission.setListState(meta.key, intent, (defaultValue, name) => { | ||
if (!Array.isArray(defaultValue) && !formdata.isPlainObject(defaultValue)) { | ||
return util.generateId(); | ||
} | ||
return getDefaultKey(defaultValue, name); | ||
}); | ||
submission.setListValue(meta.initialValue, intent); | ||
@@ -138,2 +143,8 @@ } | ||
function updateValue(meta, name, value) { | ||
if (name === '') { | ||
meta.initialValue = value; | ||
meta.value = value; | ||
meta.key = getDefaultKey(value); | ||
return; | ||
} | ||
meta.initialValue = util.clone(meta.initialValue); | ||
@@ -140,0 +151,0 @@ meta.value = util.clone(meta.value); |
@@ -6,3 +6,3 @@ { | ||
"license": "MIT", | ||
"version": "1.0.4", | ||
"version": "1.0.5", | ||
"main": "index.js", | ||
@@ -9,0 +9,0 @@ "module": "index.mjs", |
@@ -120,3 +120,3 @@ import type { DefaultValue, FieldName, FormValue } from './form'; | ||
export declare function setState(state: Record<string, unknown>, name: string, valueFn: (value: unknown) => unknown): void; | ||
export declare function setListState(state: Record<string, unknown>, intent: InsertIntent | RemoveIntent | ReorderIntent, getDefaultValue?: () => string): void; | ||
export declare function setListState(state: Record<string, unknown>, intent: InsertIntent | RemoveIntent | ReorderIntent, getDefaultValue?: (defaultValue: any, prefix?: string) => any): void; | ||
export declare function serialize<Schema>(defaultValue: DefaultValue<Schema>): FormValue<Schema>; |
@@ -242,3 +242,3 @@ 'use strict'; | ||
payload: _rollupPluginBabelHelpers.objectSpread2(_rollupPluginBabelHelpers.objectSpread2({}, intent.payload), {}, { | ||
defaultValue: getDefaultValue === null || getDefaultValue === void 0 ? void 0 : getDefaultValue() | ||
defaultValue: getDefaultValue === null || getDefaultValue === void 0 ? void 0 : getDefaultValue(intent.payload.defaultValue, intent.payload.name) | ||
}) | ||
@@ -245,0 +245,0 @@ }); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
104083
2742
81995
28