Skip to content

fix(components): reselecting a removed lineage chip now works#1126

Merged
fhennig merged 2 commits into
mainfrom
fix/multi-lineage-selector-reselect
Jul 2, 2026
Merged

fix(components): reselecting a removed lineage chip now works#1126
fhennig merged 2 commits into
mainfrom
fix/multi-lineage-selector-reselect

Conversation

@fhennig

@fhennig fhennig commented Jul 1, 2026

Copy link
Copy Markdown
Contributor

Closes #1125

Summary

After removing a chip from the multi-select lineage filter, downshift's internal selectedItem still held the removed value, so clicking that same item again produced no state change and no event. Resetting selectedItem to null in the stateReducer after each selection clears this stale reference.

Adds a regression story MultiSelectReselectAfterRemove that reproduces the original failure sequence.

PR Checklist

  • All necessary documentation has been adapted.
  • The implemented feature is covered by an appropriate test.

After removing a chip from the multi-select lineage filter, downshift's
internal selectedItem still held the removed value, so clicking that
same item again produced no state change and no event. Resetting
selectedItem to null in the stateReducer after each selection clears
this stale reference.

Adds a regression story MultiSelectReselectAfterRemove that reproduces
the original failure sequence.

Closes #1125

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
@vercel

vercel Bot commented Jul 1, 2026

Copy link
Copy Markdown

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Actions Updated (UTC)
dashboard-components Ready Ready Preview, Comment Jul 1, 2026 11:26am

Request Review

@fhennig

fhennig commented Jul 1, 2026

Copy link
Copy Markdown
Contributor Author

Claude:

The real fix (4 lines):

  1. Destructure selectItem from the useCombobox return value
  2. In the chip's × button onClick, call selectItem(null) after removeSelectedItem

Why 100 lines in the diff:

  • ~50 lines is the new MultiSelectReselectAfterRemove story (the regression test)
  • A few lines are Prettier reformatting the onClick from a one-liner to a multi-line arrow function
  • The selectedItem: null addition and removal from the stateReducer cancel each other out (that was the wrong fix, then reverted via amend)

So if you look at downshift-combobox.tsx alone, it's about 5 changed lines. The rest is the test story.

@fhennig fhennig marked this pull request as ready for review July 1, 2026 10:08
@fhennig fhennig self-assigned this Jul 1, 2026

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 Downshift multi-select edge case in the lineage filter where removing a selected chip could leave Downshift’s internal selectedItem pointing at the removed value, preventing re-selection of that same option. Adds a Storybook interaction story to reproduce and guard against the regression.

Changes:

  • Reset Downshift combobox selectedItem when a chip is removed in the multi-select combobox.
  • Add a regression Storybook play scenario that removes a lineage chip and then re-selects it from the dropdown.

Reviewed changes

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

File Description
components/src/preact/components/downshift-combobox.tsx Clears Downshift selection state after removing a selected chip in the multi-select combobox.
components/src/preact/lineageFilter/lineage-filter.stories.tsx Adds an interaction story covering “remove then reselect” for the multi-select lineage filter.

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

Comment thread components/src/preact/components/downshift-combobox.tsx
Comment thread components/src/preact/lineageFilter/lineage-filter.stories.tsx
…elect

clearAll did not call selectItem(null), leaving downshift's internal
selectedItem set to the last-selected item. Trying to pick that same
item again after clearing produced no state change and no event.

Adds a regression story MultiSelectReselectAfterClearAll.

Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>

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

Copilot reviewed 2 out of 2 changed files in this pull request and generated no new comments.

@fhennig fhennig merged commit 5ad3a24 into main Jul 2, 2026
8 of 10 checks passed
@fhennig fhennig deleted the fix/multi-lineage-selector-reselect branch July 2, 2026 12:43
fhennig pushed a commit that referenced this pull request Jul 6, 2026
🤖 I have created a release *beep* *boop*
---


##
[1.18.1](dashboard-components-v1.18.0...dashboard-components-v1.18.1)
(2026-07-02)


### Bug Fixes

* **components:** reselecting a removed lineage chip now works
([#1126](#1126))
([5ad3a24](5ad3a24))

---
This PR was generated with [Release
Please](https://github.com/googleapis/release-please). See
[documentation](https://github.com/googleapis/release-please#release-please).

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
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.

Bug: multi lineage selector: Selecting a lineage and then clearing it prevents it from being selected again

3 participants