Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Sticky] Fix Sticky to update items when props change (#11947)
### WHY are these changes introduced? Fixes Shopify/archive-polaris-backlog-2024#1603 ### WHAT is this pull request doing? `Sticky` was only registering sticky elements on `componentDidMount`. For the `IndexTable`, this happens before the `boundingElement` (i.e. the `IndexTable`) is mounted. Thus the `boundingElement` of the sticky header element in the sticky manager was actually null and the manager could not calculate when the table ends. This PR fixes that problem by adding a check in `componentDidUpdate` to see if props changed. If props change, it unregisters the old sticky item and registers a new one. ### How to 🎩 Products bug https://admin.web.business-platform-8abn.sophie-schneider.us.spin.dev/store/shop5/products/2 Companies bug https://admin.web.business-platform-8abn.sophie-schneider.us.spin.dev/store/shop5/companies/1 ### 🎩 checklist - [x] Tested a [snapshot](https://github.com/Shopify/polaris/blob/main/documentation/Releasing.md#-snapshot-releases) - [x] Tested on [mobile](https://github.com/Shopify/polaris/blob/main/documentation/Tophatting.md#cross-browser-testing) - [x] Tested on [multiple browsers](https://help.shopify.com/en/manual/shopify-admin/supported-browsers)
- Loading branch information