@@ -44,8 +44,6 @@ const NO_VALUE = Symbol('no Value');
4444 * - For each element in the `data` recursively sanitize the data, stopping at `maxItems` if specified
4545 * - Otherwise, just return the `data` removing any values after `maxItems` if it is set
4646 * - If the type of the old and new schema `items` are booleans of the same value, return `data` as is
47- * - If the new schema contains a default value then:
48- * - return the default value. We expect this to be a scalar value
4947 * - Otherwise return `undefined`
5048 *
5149 * @param validator - An implementation of the `ValidatorType` interface that will be used when necessary
@@ -54,8 +52,7 @@ const NO_VALUE = Symbol('no Value');
5452 * @param [oldSchema] - The old schema from which the data originated
5553 * @param [data={ }] - The form data associated with the schema, defaulting to an empty object when undefined
5654 * @returns - The new form data, with all the fields uniquely associated with the old schema set
57- * to `undefined`. Will return `undefined` if the new schema is not an object containing properties
58- * and doesn't provide a default value
55+ * to `undefined`. Will return `undefined` if the new schema is not an object containing properties.
5956 */
6057export default function sanitizeDataForNewSchema <
6158 T = any ,
@@ -196,12 +193,5 @@ export default function sanitizeDataForNewSchema<
196193 }
197194 // Also probably want to deal with `prefixItems` as tuples with the latest 2020 draft
198195 }
199- // Schema contains a single scalar value
200- else {
201- const newDefaultValue = get ( newSchema , 'default' ) ;
202- if ( newDefaultValue !== undefined ) {
203- newFormData = newDefaultValue ;
204- }
205- }
206196 return newFormData as T ;
207197}
0 commit comments