Skip to content

Commit

Permalink
replace unstable_deferredUpdates with rAF
Browse files Browse the repository at this point in the history
  • Loading branch information
stipsan authored and ryanflorence committed Sep 25, 2018
1 parent 68e5e94 commit 1f9f908
Showing 1 changed file with 2 additions and 6 deletions.
8 changes: 2 additions & 6 deletions src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,11 +22,6 @@ import {
} from "./lib/history";

////////////////////////////////////////////////////////////////////////////////
// React polyfill
let { unstable_deferredUpdates } = ReactDOM;
if (unstable_deferredUpdates === undefined) {
unstable_deferredUpdates = fn => fn();
}

const createNamedContext = (name, defaultValue) => {
const Ctx = createContext(defaultValue);
Expand Down Expand Up @@ -102,7 +97,8 @@ class LocationProvider extends React.Component {
} = this;
refs.unlisten = history.listen(() => {
Promise.resolve().then(() => {
unstable_deferredUpdates(() => {
// TODO: replace rAF with react deferred update API when it's ready https://github.com/facebook/react/issues/13306
requestAnimationFrame(() => {
if (!this.unmounted) {
this.setState(() => ({ context: this.getContext() }));
}
Expand Down

0 comments on commit 1f9f908

Please sign in to comment.