-
Notifications
You must be signed in to change notification settings - Fork 2.2k
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
Performance Issue: Frequently re-compiling (sub)schemas in AJV #1961
Comments
@Viswanathan24 can you post your schema and the form data? Ideally a link to a playground example would be best. |
@epicfaace Please find the link below and help me to resolve it. |
My browser doesn't crash on that example, though it is a bit slow to add / remove / modify items. |
I faced with this issue too. This performance issue appears when your schema is large enough and has a lot of
any performance issues were gone. But you need to assure that you do not pass schema into the form as a new object every time (something like |
@nickgros Please take a look at this proposed change and share your feedback. |
@AlimovSV I tried to tackle this some time ago with tons of memoization, and mapping schemas to compiled validators: #2466. I had the same takeaway as you finding that conditional behavior ends up triggering expensive synchronous compilation in AJV, and we end up not taking advantage of its built-in cache. Your solution is much more simple than mine! If it significantly improves performance without causing any regressions, I think it would be worth adding. We could add a note in the docs or come up with some other solution to warn users to memoize their schema. Tangentially related, @heath-freenome is planning on externalizing validation in #2693. Perhaps during/after that change we could take advantage of asynchronous compilation/validation. |
#2693 is done, so we would be happy to accept a PR in the validator/ajv-8 repo in v5 @lpillonel @AlimovSV |
I am facing this issue too. My schema has a lot of Is there any workaround or beta version that includes the change? Love this package! 👌 |
We are facing this issue with our large schema and conditional fields. Typing in inputs is a bit laggy, especially when more array items are added. It would be great to have the above mentioned solution implemented in the package. |
Theoretically this was fixed with #3721. Sounds like maybe it didn't work? |
This is a major problem for me as well. I have lots of |
@cwendtxealth Is this what you were talking about at today's meeting? Could you poke at this issue and see if you can solve the performance issue? @magaton have you tried precompiled schemas? |
I think I am experiencing the same problems here as well, I do have a rather big schema with including a large In my case it seems like I am able to eliminate the calls to Please take everything I wrote with a grain of salt, I'm not at all experienced with Javascript, React, nor rjsf. So please excuse me if my idea does not make any sense. Thanks a lot for putting the work into this component, it is really handy for us. |
I'm using the schema with this shape below, and the {
"definitions": {},
"root": {},
"$ref": "#/definitions/something",
"$id": 312321321 // this is Date.now(). I'm doing this because, my use case can update the schema.
} |
Yeah, |
Also the field schema could get the schema from the form, that the Form render |
I deleted the comment, because I didn't think through the part where |
@AlimovSV , Can you please suggest how do i prevent passing the schema as a new object from parent to child component (which has rjsf form) ? as i am storing schema in parent state and on passing to child, the child will have new object. Any suggestions would be highly appreciated ! Thanks |
@ani9450 First of all, I would say that this ticket is obsolete and RJSF team made a lot of work to cover the case with slow performance (big thanks all of them!). Regarding schema, unfortunately the passing of the new schema object into the child component is a by-design decision (because a schema for child component may depends on the current form state and have to be resolved (this means = create new object). |
I am closing this ticket as there is a newer, more relevant ticket related to performance |
i am fetching formData from MongoDB and loading it as initial data, and allowing user to modify, it's like updating existing data,in that i could notice some performance issue when the Jsonschema have more no.of array of items then the browser is crashing and it is not allowing to make any changes for more than 20 mins. can some one help me on this.
Example data:-
in above image ruleSteps as 106 elements were finding difficulty to display the form with existing data.
i am using react-jsonschema-form version 1.8.1, Please let me know if any further details is required to troubleshoot the issue
The text was updated successfully, but these errors were encountered: