From e47b804d59c8895c2bb2308205fd51334fb3bbeb Mon Sep 17 00:00:00 2001 From: Chloe Rice Date: Mon, 20 Apr 2020 17:30:44 -0400 Subject: [PATCH 1/2] [ResourceItem] Remove children from the equality check in SCU --- src/components/ResourceItem/ResourceItem.tsx | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/components/ResourceItem/ResourceItem.tsx b/src/components/ResourceItem/ResourceItem.tsx index 99fdf3649b4..1d2eb9f7ae7 100644 --- a/src/components/ResourceItem/ResourceItem.tsx +++ b/src/components/ResourceItem/ResourceItem.tsx @@ -111,15 +111,19 @@ class BaseResourceItem extends React.Component { shouldComponentUpdate(nextProps: CombinedProps, nextState: State) { const { + children: nextChildren, context: {selectedItems: nextSelectedItems, ...restNextContext}, ...restNextProps } = nextProps; + const { + children, context: {selectedItems, ...restContext}, ...restProps } = this.props; const nextSelectMode = nextProps.context.selectMode; + return ( !isEqual(this.state, nextState) || this.props.context.selectMode !== nextSelectMode || From a7a881e3a4bda304a9f3cd5c0d4054c8a9adb317 Mon Sep 17 00:00:00 2001 From: Chloe Rice Date: Wed, 22 Apr 2020 17:20:18 -0400 Subject: [PATCH 2/2] Update unreleased change log --- UNRELEASED.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/UNRELEASED.md b/UNRELEASED.md index a2725494e60..e4852305ae7 100644 --- a/UNRELEASED.md +++ b/UNRELEASED.md @@ -8,6 +8,8 @@ ### Bug fixes +- Fixed performance of `ResourceItem` due to inclusion of `children` in deep prop comparison within `shouldComponentUpdate` ([#2936](https://github.com/Shopify/polaris-react/pull/2936)) + ### Documentation ### Development workflow