-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Description
Issue summary
When using the <ResourceList /> component, and passing a custom child component to the <ResourceList.Item /> that has a loading state attached to an API call, shouldComponentUpdate does some deep comparisons on the props to determine if the item should re-render, which causes a blocking of the rendering of the page for very long periods of time for the specific use-case.
Expected behavior
shouldComponentUpdate optimizes its comparison of possible complex child components.
Deep comparisons in shouldComponentUpdate aren't ideal, see related issue
Actual behavior
Use-case example
This was found in the Shopify web admin, blocking for 13 seconds in this example - locally this comparison is much faster, but still observable.
| Performance profile example of the use-case in production |
|---|
![]() |
isEqual starts to go very deep in React FiberNodes |
|---|
![]() |
Steps to reproduce the problem
This is difficult because the lag is only very noticeable on the production code of Shopify web.
However, here's a sandbox that tries to mimic the same behavior:
https://codesandbox.io/embed/festive-oskar-xq5xz?fontsize=14
The performance profile of that sandbox looking at the isEqual check |
|---|
![]() |
Related issue for Shopify admin web is https://github.com/Shopify/store/issues/9546
Removing this props deep equal check from the Shopify web production build resolves this issue.
Specifications
System:
OS: macOS 10.14.5
CPU: (8) x64 Intel(R) Core(TM) i7-7700HQ CPU @ 2.80GHz
Memory: 125.98 MB / 16.00 GB
Shell: Unknown
Binaries:
Node: 10.13.0 - ~/.nvm/versions/node/v10.13.0/bin/node
Yarn: 1.15.2 - /usr/local/bin/yarn
npm: 6.4.1 - ~/.nvm/versions/node/v10.13.0/bin/npm
Watchman: 4.9.0 - /usr/local/bin/watchman
Browsers:
Chrome: 76.0.3809.132
Firefox: 68.0.2
Safari: 12.1.1
npmPackages:
react: ^16.8.6 => 16.8.6
react-dom: ^16.8.6 => 16.8.6


