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

Custom Validation started to fail with upgrade to version 5.24.2 #4475

Open
3 of 4 tasks
rgciocan opened this issue Jan 31, 2025 · 3 comments
Open
3 of 4 tasks

Custom Validation started to fail with upgrade to version 5.24.2 #4475

rgciocan opened this issue Jan 31, 2025 · 3 comments

Comments

@rgciocan
Copy link

Prerequisites

What theme are you using?

validator-ajv8

Version

5.24.2

Current Behavior

Using custom validation examples from the documentation, when rendering the schema I get the browser console error:

Maximum call stack size exceeded
RangeError: Maximum call stack size exceeded
at areObjectsEqual (http://localhost:3000/bundle.js:550581:25)
at comparator (http://localhost:3000/bundle.js:550840:17)
at Object.equals (http://localhost:3000/bundle.js:550928:16)
at areArraysEqual (http://localhost:3000/bundle.js:550500:20)
at comparator (http://localhost:3000/bundle.js:550793:20)
at Object.equals (http://localhost:3000/bundle.js:550928:16)
at isPropertyEqual (http://localhost:3000/bundle.js:550718:15)
at areObjectsEqual (http://localhost:3000/bundle.js:550592:14)
at comparator (http://localhost:3000/bundle.js:550840:17)
at Object.equals (http://localhost:3000/bundle.js:550928:16)

Also, testing the code with jest I get:
detail: RangeError: Maximum call stack size exceeded
at comparator (/home/rgciocan/WORK/dev/sources/marketplace-web/node_modules/fast-equals/src/comparator.ts:76:29)
at Object.equals (/home/rgciocan/WORK/dev/sources/marketplace-web/node_modules/fast-equals/src/comparator.ts:307:12)
at isPropertyEqual (/home/rgciocan/WORK/dev/sources/marketplace-web/node_modules/fast-equals/src/equals.ts:349:11)
at areObjectsEqual (/home/rgciocan/WORK/dev/sources/marketplace-web/node_modules/fast-equals/src/equals.ts:158:10)
at comparator (/home/rgciocan/WORK/dev/sources/marketplace-web/node_modules/fast-equals/src/comparator.ts:194:9)

This is one of the examples I've used:

const validator = customizeValidator<Record<string, any>>({
		ajvOptionsOverrides: {
			strictNumbers: true
		}
	});

return 
	<Form<Record<string, any>>
		className={`rjsf tw-bg-unbranded tw-text-unbranded ${className}`}
		schema={schema}
		formData={data}
		extraErrors={fieldErrors}
		showErrorList={false}
		uiSchema={uiSchema}
		widgets={widgets}
		validator={validator}
		templates={templates}
		onChange={(formData: any) => onChange?.(formData)}
		transformErrors={(errs: any) => {
			setTimeout(() => onErrors?.(errs), 0);
			return errs;
		}}
		liveValidate={!!onErrors && !schema?.readOnly}
		liveOmit
		omitExtraData
	/>

When I use a standard validator, rendering of the schema works fine.

Expected Behavior

Schema should render fine.

Steps To Reproduce

No response

Environment

- OS:
- Node:
- npm:

Anything else?

No response

@rgciocan rgciocan added bug needs triage Initial label given, to be assigned correct labels and assigned labels Jan 31, 2025
@heath-freenome
Copy link
Member

heath-freenome commented Jan 31, 2025

@rgciocan Can you roll back to 5.24.1 and see if that causes the same issue? And if it still happens then roll back to 5.23.x and see. Thanks.

@heath-freenome heath-freenome added awaiting response and removed needs triage Initial label given, to be assigned correct labels and assigned labels Jan 31, 2025
@vpsantos
Copy link

The same problem here.

@heath-freenome 5.24.1 works fine.

@rgciocan
Copy link
Author

@heath-freenome 5.24.1 works fine for me too, I already rolled back. Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants