Skip to content

Fix Filter Panel Persistence Bug (CRASM-3719)#1486

Open
hawkishpolicy wants to merge 4 commits intodevelopfrom
Manage-Orgs-Popup-Persists-Bug-CRASM-3719
Open

Fix Filter Panel Persistence Bug (CRASM-3719)#1486
hawkishpolicy wants to merge 4 commits intodevelopfrom
Manage-Orgs-Popup-Persists-Bug-CRASM-3719

Conversation

@hawkishpolicy
Copy link
Contributor

Fix Filter Panel Persistence Bug (CRASM-3719)

🗣 Description

  • Previous addition of onClose logic to panel prop prevented panel from closing when user clicked outside of it.
  • Removed onClose prop to restore default behavior.
  • Added new helper function to determine if filter model is empty.
  • Refactored shouldTriggerFilterUpdate to account for a filter model that had values but was deleted to be empty.
    • This allows user to clear a filter value and send for a generic "all" call.
  • Updated onFilterModelChange flow to set filters in this order:
    1. Clean filter model.
    2. Set filters to cleaned model.
    3. Check if cleaned model is empty; if so, set HasActiveFilters to false.
    4. Call shouldTriggerFilterUpdate with previous filters and cleaned model to determine if fetch is needed.
    5. If not, return early.
    6. If filter timeout exists, clear it.
    7. If filter model is empty, set filters to empty object to fetch all data. Return early.
    8. Otherwise, set timeout to update filters, set isLoading, and setPagination after 500 milliseconds.

💭 Motivation and context

  • Closes CRASM-3719

🧪 Testing

  • tested locally.
  • added unit tests.

✅ Pre-approval checklist

  • This PR has an informative and human-readable title.
  • Changes are limited to a single goal - eschew scope creep!
  • All future TODOs are captured in issues, which are referenced in code comments.
  • All relevant type-of-change labels have been added.
  • I have read the CONTRIBUTING document.
  • These code changes follow cisagov code standards.
  • All relevant repo and/or project documentation has been updated to reflect the changes in this PR.
  • Tests have been added and/or modified to cover the changes in this PR.
  • All new and existing tests pass.
  • Bump major, minor, patch, pre-release, and/or build versions as appropriate via the bump_version script if this repository is versioned and the changes in this PR warrant a version bump.
  • Create a pre-release (necessary if and only if the pre-release version was bumped).

✅ Pre-merge checklist

  • Revert dependencies to default branches.
  • Finalize version.

✅ Post-merge checklist

  • Create a release (necessary if and only if the version was bumped).

- Previous addition of onClose logic to panel prop prevented panel from closing when user clicked outside of it.
- Removed onClose prop to restore default behavior.
- Added new helper function to determine if filter model is empty.
- Refactored shouldTriggerFilterUpdate to account for a filter model that had values but was deleted to be empty.
  - This allows user to clear a filter value and send for a generic "all" call.
- Updated onFilterModelChange flow to set filters in this order:
    1. Clean filter model.
    2. Set filters to cleaned model.
    3. Check if cleaned model is empty; if so, set HasActiveFilters to false.
    4. Call shouldTriggerFilterUpdate with previous filters and cleaned model to determine if fetch is needed.
    5. If not, return early.
    6. If filter timeout exists, clear it.
    7. If filter model is empty, set filters to empty object to fetch all data. Return early.
    8. Otherwise, set timeout to update filters, set isLoading, and setPagination after 500 milliseconds.
@hawkishpolicy hawkishpolicy self-assigned this Feb 2, 2026
- Added new unit tests for getActiveItems utility function.
- Refactored existing unit tests for shouldTriggerFilterUpdate to cover user deleting filter values and need a genreric "all" call.
@coveralls
Copy link

Coverage Status

coverage: 43.543% (+0.05%) from 43.496%
when pulling 4e7e8a7 on Manage-Orgs-Popup-Persists-Bug-CRASM-3719
into f68da0f on develop.

@hawkishpolicy hawkishpolicy marked this pull request as ready for review February 2, 2026 15:10
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants