-
Notifications
You must be signed in to change notification settings - Fork 19
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
STSMACOM-876 <EditableListForm>
state.status
initialize as null
so it can pass null
re-initialization checks on component update.
#1540
Conversation
… so it can pass `null` re-initialization checks on component update.
d306327
to
23eb3bb
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Oh, I hate these old, uncommented, heavily-lifecycle-dependent class components so much.
I understand your logic: if we initialize status
to []
in the constructor, gDSFP will never rebuild it because []
isn't falsey. Fine. But, is initializing to null
correct since we know it's supposed to be an array, or is there a better fix in gDSFP like if (isEmpty(this.status))
?
I'm OK with this change. I just want to be sure it's the best/clearest change we can make that will resolve this bug.
PS, @BogdanDenis, please make sure to move the ticket to "awaiting release" when this merges. Technically, this should go into the CHANGELOG under 9.3.0 and merge to master, and then I'll cherry pick it onto the b9.2 release branch. |
…n re-initialization checks on component update.
@zburke That's a good suggestion to use |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@BogdanDenis will this work correctly if we only include the gDSFP change?
It does, I've updated the PR |
Quality Gate passedIssues Measures |
… so it can pass `null` re-initialization checks on component update. (#1540) ## Description Uncaught error in `setError` because `state.status` array is empty and we're trying to access an nth element when deleting a record has failed. This is because `status.empty` is initialized in the constructor as `[]` but the re-initialization check in `getDerivedStateFromProps` checks for `!state.status`, so it's never again re-initialized (unless you add a new field which always re-initializes the state) ## Screenshots https://github.com/user-attachments/assets/81511ca8-c338-43ad-ba41-a797134ff31c ## Issues [STSMACOM-876](https://folio-org.atlassian.net/browse/STSMACOM-876) (cherry picked from commit 45615a8)
Description
Uncaught error in
setError
becausestate.status
array is empty and we're trying to access an nth element when deleting a record has failed.This is because
status.empty
is initialized in the constructor as[]
but the re-initialization check ingetDerivedStateFromProps
checks for!state.status
, so it's never again re-initialized (unless you add a new field which always re-initializes the state)Screenshots
chrome_EvhYsh7s6H.mp4
Issues
STSMACOM-876