Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: prevent ScrollProvider from causing unnecessary rerender #899

Merged
merged 1 commit into from
Mar 6, 2023

Conversation

Seavenly
Copy link
Collaborator

@Seavenly Seavenly commented Jan 27, 2023

Changing from useState to useRef to keep track of the list of callbacks registered to the ScrollProvider to prevent unnecessary top-down rerenders when a callback is added or removed. This swap from useState to useRef works because the event of adding and removing scroll event callbacks does not affect the presentation at all that would require a rerender. The code in the callbacks should be the only thing responsible for possibly changing state and requiring a rerender. This change does not impact the frequency or result of the callbacks when called.

@paypal-rosman paypal-rosman merged commit 32a5575 into paypal:develop Mar 6, 2023
github-actions bot pushed a commit that referenced this pull request Mar 6, 2023
### [1.40.2](v1.40.1...v1.40.2) (2023-03-06)

### Bug Fixes

* Accessibility Issue: Messages Space Issue for Screen Reader (DTCRCMERC-1897) ([#907](#907)) ([3e0bef5](3e0bef5))
* prevent ScrollProvider from causing unnecessary rerender ([#899](#899)) ([32a5575](32a5575))
* Screen Reader Issue Messages Paypal Logo (DTCRCMERC-1899) ([#909](#909)) ([47694bf](47694bf))

### Code Refactoring

* support APR disclaimer from modal offers content ([#911](#911)) ([ab01526](ab01526))
@github-actions
Copy link

github-actions bot commented Mar 6, 2023

🎉 This PR is included in version 1.40.2 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants