Skip to content

Commit

Permalink
Allow non-memoized item lists
Browse files Browse the repository at this point in the history
Towards primer#4315

The SelectPanel only did a basic equality check for the item state, meaning
that it depended on having the exact same objects on multiple pass throughs.

This isn't always possible as sometimes you may want to have different objects.

This replaces the equality check with a test for an `id` property on the object.

If the `id` property isn't present, we fallback to the old behavior.

Note that a previous version used the `key` prop, but we decided `id` was a
better interface. f472da2#r139163795
Co-authored-by: Andrew Henry <[email protected]>
  • Loading branch information
ipc103 committed Feb 28, 2024
1 parent c73102c commit 82af2f0
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions .changeset/violet-yaks-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'@primer/react': patch
---

Fixes a bug in `SelectPanel` when the list of items was not memoized.

0 comments on commit 82af2f0

Please sign in to comment.