-
Notifications
You must be signed in to change notification settings - Fork 1.1k
fix: Fix bug on incidents pagination #5058
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
Conversation
β¦onChange handler
|
The latest updates on your projects. Learn more about Vercel for Git βοΈ
|
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.
lgtm
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.
Bug: Undefined Array Handling Causes Type Error
A TypeError occurs when currentState.facetOptions?.[facetId] is undefined because .map() is called directly on it before the || [] fallback can be applied. This affects the toggleFacetOption and selectAllFacetOptions functions. In toggleFacetOption, this specifically breaks the logic intended to select all options except the toggled one when a facet has no prior state, resulting in an empty selection instead. The fix requires ensuring currentState.facetOptions?.[facetId] is an array before .map() is called, e.g., (currentState.facetOptions?.[facetId] || []).
keep-ui/features/filter/store/create-facets-store.ts#L104-L110
keep/keep-ui/features/filter/store/create-facets-store.ts
Lines 104 to 110 in 32cd14f
| if (!facetsState[facetId]) { | |
| newFacetState = toFacetState( | |
| currentState.facetOptions?.[facetId] | |
| .map((option) => valueToString(option.value)) | |
| .filter((optionStrValue) => optionStrValue !== strValue) || [] | |
| ); |
keep-ui/features/filter/store/create-facets-store.ts#L160-L165
keep/keep-ui/features/filter/store/create-facets-store.ts
Lines 160 to 165 in 32cd14f
| ...facetsState, | |
| [facetId]: toFacetState( | |
| currentState.facetOptions?.[facetId].map((option) => | |
| valueToString(option.value) | |
| ) || [] | |
| ), |
Was this report helpful? Give feedback by reacting with π or π
Closes #5055
π Description
β Checks
βΉ Additional Information