From 82af2f0cc1ffd5c5dcb53c383db1a73b5e30fb7b Mon Sep 17 00:00:00 2001 From: Ian Candy Date: Tue, 27 Feb 2024 22:01:53 +0000 Subject: [PATCH] Allow non-memoized item lists Towards https://github.com/primer/react/issues/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. https://github.com/ipc103/primer-react/commit/f472da25d4f1ff48326c0056aa1696c9c94b4f81#r139163795 Co-authored-by: Andrew Henry --- .changeset/violet-yaks-lie.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/violet-yaks-lie.md diff --git a/.changeset/violet-yaks-lie.md b/.changeset/violet-yaks-lie.md new file mode 100644 index 00000000000..f0cdd470bc3 --- /dev/null +++ b/.changeset/violet-yaks-lie.md @@ -0,0 +1,5 @@ +--- +'@primer/react': patch +--- + +Fixes a bug in `SelectPanel` when the list of items was not memoized.