Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace in utils fastCloneDeep func cloning with json.parse-stringiry to structuredClone api #5942

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions src/utils/utils.js
Original file line number Diff line number Diff line change
Expand Up @@ -154,7 +154,7 @@ export function checkCalculated(component, submission, rowData) {
}

/**
* Check if a simple conditional evaluates to true.
* Check if a simple conditional evaluates to true.
* @param {import('@formio/core').Component} component - The component to check for the conditional.
* @param {import('@formio/core').SimpleConditional} condition - The condition to check.
* @param {*} row - The row data for the component.
Expand Down Expand Up @@ -306,7 +306,7 @@ export function getComponentActualValue(compPath, data, row) {
if (row && _.isNil(value)) {
value = getValue({ data: row }, compPath);
}

// FOR-400 - Fix issue where falsey values were being evaluated as show=true
if (_.isNil(value) || (_.isObject(value) && _.isEmpty(value))) {
value = '';
Expand Down Expand Up @@ -341,7 +341,7 @@ export function checkCustomConditional(component, custom, row, data, form, varia

/**
* Check a component for JSON conditionals.
* @param {import('@formio/core').Component} component - The component
* @param {import('@formio/core').Component} component - The component
* @param {import('@formio/core').JSONConditional} json - The json conditional to check.
* @param {*} row - The contextual row data for the component.
* @param {*} data - The full submission data.
Expand Down Expand Up @@ -1488,7 +1488,7 @@ export function sanitize(string, options) {
* @returns {any} - The cloned object.
*/
export function fastCloneDeep(obj) {
return obj ? JSON.parse(JSON.stringify(obj)) : obj;
return obj ? structuredClone(obj) : obj;
}

export { Evaluator, interpolate };
Expand Down