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

unstable_deferredUpdates is removed from react, replace with rAF #159

Merged
merged 1 commit into from
Sep 25, 2018
Merged

unstable_deferredUpdates is removed from react, replace with rAF #159

merged 1 commit into from
Sep 25, 2018

Conversation

stipsan
Copy link
Contributor

@stipsan stipsan commented Sep 16, 2018

See facebook/react#13488

Both requestIdleCallback and requestAnimationFrame are suggested as alternatives until the API is ready. I went with requestAnimationFrame since react already expect you to polyfill it.

@mehiel
Copy link

mehiel commented Sep 16, 2018

@stipsan is this better than following the schedule package?

I know the API is unstable and subject to change but maybe better to stay closer to that as this is going to be the suggested way to scheduleWork.

Example from react time-slicing demo:
https://github.com/facebook/react/blob/master/fixtures/unstable-async/time-slicing/src/index.js#L110

@stipsan
Copy link
Contributor Author

stipsan commented Sep 16, 2018

@stipsan is this better than following the schedule package?

No, the schedule package is probably better since it's essentially polyfilling requestIdleCallback 😄

But I have not tested it and the readme for the fixture you're referring to suggest that there might be some issues they haven't solved yet: https://github.com/facebook/react/tree/master/fixtures/unstable-async/time-slicing#can-i-use-this-code-in-production

Another facebook team also went with requestAnimationFrame btw: facebookarchive/nuclide@43cb702

@karlguillotte
Copy link

karlguillotte commented Sep 25, 2018

I came across an issue using <Location>, my children render function was called too many times. I replaced the implementation with requestAnimationFrame and it solves my issue.

Please note that overwritting the shouldComponentUpdate hook in the returned element from my render function had no effect, I was always getting a different location.

Thanks @stipsan! Now it would be great to see that PR merged and RIP React Router!

@ryanflorence
Copy link
Member

I use rAF for scheduling focus after render in @reach/menu-button, too. thanks!

@ryanflorence ryanflorence merged commit 1f9f908 into reach:master Sep 25, 2018
@stipsan stipsan deleted the patch-2 branch September 28, 2018 05:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants