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

TypeError: Cannot read properties of null (reading '__errors') in Form.filterUndefinedErrors #4306

Closed
3 of 4 tasks
christian-fischer opened this issue Sep 18, 2024 · 0 comments · Fixed by #4310
Closed
3 of 4 tasks

Comments

@christian-fischer
Copy link

Prerequisites

What theme are you using?

core

Version

5.20.0

Current Behavior

We noticed the following error:

TypeError: Cannot read properties of null (reading '__errors')
    at  (../node_modules/@rjsf/core/src/components/Form.tsx:611:79)
    at iteratee (../node_modules/lodash/_createBaseFor.js:17:10)
    at baseFor (../node_modules/lodash/_baseForOwn.js:13:19)
    at eachFunc (../node_modules/lodash/_createBaseEach.js:17:13)
    at func (../node_modules/lodash/forEach.js:38:9)
    at errors (../node_modules/@rjsf/core/src/components/Form.tsx:608:15)
    at filterUndefinedErrors (../node_modules/@rjsf/core/src/components/Form.tsx:612:10)
    at iteratee (../node_modules/lodash/_createBaseFor.js:17:10)
    at baseFor (../node_modules/lodash/_baseForOwn.js:13:19)
    at eachFunc (../node_modules/lodash/_createBaseEach.js:17:13)

Expected Behavior

No error

Steps To Reproduce

So far I've been unable to reproduce this issue.

But based on the stacktrace I could pinpoint it to this location:
4d3094c#diff-704dadefdc8b52ac02d6712540e5734214e9699c66d1d673ded1c57e96df9303R611

Looks like this was newly introduced with version 5.20.0

Environment

- OS: Mac OS X 10.15.7
- Node: v20.11.1
- npm: 10.8.2

Anything else?

Proposed solution:

  • it might mitigate the issue to replace the check for undefined in line 609 of Form.tsx with a lodash isNil call instead
@christian-fischer christian-fischer added bug needs triage Initial label given, to be assigned correct labels and assigned labels Sep 18, 2024
@heath-freenome heath-freenome added core and removed needs triage Initial label given, to be assigned correct labels and assigned labels Sep 20, 2024
heath-freenome added a commit to heath-freenome/react-jsonschema-form that referenced this issue Sep 20, 2024
…ma()

Fixes rjsf-team#4306 by using `lodash.isNil()` instead of comparing to `undefined`
- Updated `Form.filterErrorsBasedOnSchema()` to use lodash `isNil()` to check if the key is either null or undefined
- Updated the `CHANGELOG.md` accordingly
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
2 participants