Skip to content

Conversation

skynetigor
Copy link
Contributor

@skynetigor skynetigor commented Jun 18, 2025

Closes #5055

πŸ“‘ Description

  • Move toggle/selectOne/selectAll functions to store from Facet component
  • Write unit-tests for toggle/selectOne/selectAll in store
  • Fix pagination bug on incidents

βœ… Checks

  • My pull request adheres to the code style of this project
  • My code requires changes to the documentation
  • I have updated the documentation as required
  • All the tests have passed

β„Ή Additional Information

@vercel
Copy link

vercel bot commented Jun 18, 2025

The latest updates on your projects. Learn more about Vercel for Git β†—οΈŽ

Name Status Preview Comments Updated (UTC)
keep βœ… Ready (Inspect) Visit Preview πŸ’¬ Add feedback Jun 18, 2025 11:01am

@skynetigor skynetigor marked this pull request as ready for review June 18, 2025 11:08
@dosubot dosubot bot added size:L This PR changes 100-499 lines, ignoring generated files. Bug Something isn't working UI User interface related issues labels Jun 18, 2025
Copy link
Member

@shahargl shahargl left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm

@dosubot dosubot bot added the lgtm This PR has been approved by a maintainer label Jun 18, 2025
Copy link

@cursor cursor bot left a 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

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

...facetsState,
[facetId]: toFacetState(
currentState.facetOptions?.[facetId].map((option) =>
valueToString(option.value)
) || []
),

Fix in Cursor


Was this report helpful? Give feedback by reacting with πŸ‘ or πŸ‘Ž

@skynetigor skynetigor merged commit a95becc into main Jun 18, 2025
18 checks passed
@skynetigor skynetigor deleted the 5055-multiple-bugs branch June 18, 2025 11:32
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Bug Something isn't working lgtm This PR has been approved by a maintainer size:L This PR changes 100-499 lines, ignoring generated files. UI User interface related issues

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[πŸ› Bug]: Changing Page, or Number of incidents per page, has conflicting logic

2 participants