Comments (9)
Thank you for this report 👍
from react-jsonschema-form.
If we want to properly implement shouldComponentUpdate
, we'll have to rely on some immutable library like Immutable.js, which was something I tried to avoid.
But I agree the impact on performances on lower end machines might get really important, so we should do this upgrade.
(And yeah, kudos for the super clean and useful report.)
from react-jsonschema-form.
If we want to properly implement
shouldComponentUpdate
, we'll have to rely on some immutable library
Again, pardon my ignorance of the codebase and whether these suggestions have already been considered, but it's quite possible to perform shallow comparison (i.e. pure render) even with plain object properties, so long as you're careful not to mutate the original when updating.
Object.assign( {}, original, { input: 'New Value' } );
Or, for deeply nested objects, consider pulling in lodash.merge
(available as standalone package):
merge( {}, original, { foo: { bar: { input: 'New Value' } } } );
from react-jsonschema-form.
The problem is not with copying/merging deeply nested objects, it's with comparing them to know if they've changed.
({a: 1, b: {c: 2}}) === ({a: 1, b: {c: 2}}) // false
And shouldComponentUpdate
needs to return a boolean to trigger a render when things have changed. So we need immutable data structures which don't carry identity as plain js objects do, so we can safely compare them and return the appropriate boolean value there.
Am I missing something obvious? I didn't have my first coffee of the day just yet.
from react-jsonschema-form.
Does this affect the demo only or the form rendering itself?
from react-jsonschema-form.
@leplatrem : I'm observing it in my own usage as well, but the demo was the easiest way for me to illustrate the problem.
from react-jsonschema-form.
It may be related to kinto-admin, but when viewing a page with a few hundred records (for the blocklist), the page is very laggy, unresponsive, and even freezes for a couple of seconds at the beginning.
from react-jsonschema-form.
Might be compounded with the fact that JSON schema validation is performed on every change:
https://github.com/mozilla-services/react-jsonschema-form/blob/afcb38e/src/components/Form.js#L51
from react-jsonschema-form.
This is probably the very first thing to investigate as a solution https://facebook.github.io/react/docs/shallow-compare.html
from react-jsonschema-form.
Related Issues (20)
- DOCUMENTATION Issue: Wrong method signature? HOT 1
- Schema defines standalone checkbox as mandatory, but asterisk is not rendered. HOT 2
- I would like to make a default change to the look of all input fields HOT 5
- Adding required field in nested if/then/else not working correctly HOT 2
- FormData is not received based on schema properties HOT 1
- Select bug when multiple oneOf are nested HOT 2
- How can I cite this? HOT 6
- RJSF anyOf customization HOT 3
- Validation error when multiple $ref references point to a single definition HOT 3
- not working about validation HOT 3
- Passing ui options down to array items HOT 3
- MUI number input label UI issue with non-numeric input HOT 1
- Publish v6 release candidate with support for Bootstrap 5 HOT 1
- Can not replace "integer" widget HOT 4
- Omit Extra Data not behaving as expected on submit for allOf (if then) schemas along with additionalProperties set to false blocking form submission HOT 1
- `anyOf` form validation error messages confusing when `anyOf` items contain properties found in other items HOT 4
- How to reference an array field from an enum field?
- Array Length dependant on FormContext Value
- Add support for tremor UI library
- Issue with data of files array when we have validation required and minItems HOT 1
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from react-jsonschema-form.