Skip to content

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

Merged
cduhn17 merged 8 commits into
developfrom
Manage-Orgs-Popup-Persists-Bug-CRASM-3719
Jun 18, 2026
Merged

Fix Filter Panel Persistence Bug (CRASM-3719)#1486
cduhn17 merged 8 commits into
developfrom
Manage-Orgs-Popup-Persists-Bug-CRASM-3719

Conversation

@hawkishpolicy

@hawkishpolicy hawkishpolicy commented Feb 2, 2026

Copy link
Copy Markdown
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.
  • Applied these changes to Vulnerabilities table as well.

  • Domains uses similar logic.

  • Will create a ticket to standardize all mount/unmount behavior and onFilteModelChange logic across all tables.

  • Also made a quick correction to the "neutrals light" color value that was approved via design team.

💭 Motivation and context

  • Closes CRASM-3719

🧪 Testing

  • tested locally.
  • added unit tests.

📷 Screenshots (if appropriate)

Screen.Recording.2026-06-16.at.1.00.06.PM.mov
Screen.Recording.2026-06-16.at.4.30.24.PM.mov

✅ 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
Copy Markdown

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
@ameliav ameliav self-requested a review June 15, 2026 20:28
@ameliav

ameliav commented Jun 15, 2026

Copy link
Copy Markdown
Contributor

Are there any relevant screenshots that can be added to this PR?

@hawkishpolicy

Copy link
Copy Markdown
Contributor Author

Are there any relevant screenshots that can be added to this PR?

I'm going to post a video once I address the dependencies and unit tests.

- Removed commented out code for MUI filter panel onClose event handler in the Vulnerabilities.tsx file.
- Removed the setHasActiveFilters state update from the onClose event handler, as it is not needed and can be determined from the filters state.

@ameliav ameliav left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@cduhn17 cduhn17 merged commit 6f1204f into develop Jun 18, 2026
18 checks passed
@cduhn17 cduhn17 deleted the Manage-Orgs-Popup-Persists-Bug-CRASM-3719 branch June 18, 2026 11:19
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.

5 participants