Skip to content

Fix dimension filter chip exclude rerender#9624

Open
nishantmonu51 wants to merge 1 commit into
mainfrom
setState_bug
Open

Fix dimension filter chip exclude rerender#9624
nishantmonu51 wants to merge 1 commit into
mainfrom
setState_bug

Conversation

@nishantmonu51

Copy link
Copy Markdown
Collaborator

Fixes a stale dimension filter chip state when an existing chip is rerendered with only its include/exclude operator changed, such as applying embed setState with IN -> NIN or NIN -> IN.

The chip component was caching curExcludeMode locally and only resyncing closed state when the filter mode changed. Since IN and NIN are both Select mode, the data query and URL state updated but the chip label/class could stay stuck on the initial operator.

Added a regression test that rerenders the same dimension filter chip from exclude to include and verifies the label and exclude class update.

Checklist:

  • Covered by tests
  • Ran it and it works as intended
  • Reviewed the diff before requesting a review
  • Checked for unhandled edge cases
  • Linked the issues it closes
  • Checked if the docs need to be updated. If so, create a separate Linear DOCS issue
  • Intend to cherry-pick into the release branch
  • I'm proud of this work!

Tested with:

npm run test -w web-common -- src/features/dashboards/filters/dimension-filters/DimensionFilter.spec.ts

Copilot AI 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.

Pull request overview

Fixes a stale dimension filter chip UI state when an existing chip is rerendered with only its include/exclude operator changed (e.g., INNIN), ensuring the chip label and styling stay in sync with updated filter props.

Changes:

  • Updates the closed-state resync condition to also trigger when isInclude (exclude mode) changes, not only when the filter mode changes.
  • Adds a regression test that rerenders a dimension filter from exclude → include and asserts the chip label and exclude class update accordingly.

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 1 comment.

File Description
web-common/src/features/dashboards/filters/dimension-filters/DimensionFilter.svelte Extends the closed-state resync condition to include include/exclude operator changes so the chip UI doesn’t get stuck.
web-common/src/features/dashboards/filters/dimension-filters/DimensionFilter.spec.ts Adds a regression test covering rerender behavior when only isInclude flips.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants