-
-
Notifications
You must be signed in to change notification settings - Fork 654
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Refactor and perf improve Rehydration (#1121)
- Loading branch information
1 parent
cf72c8e
commit ee0cd34
Showing
10 changed files
with
47 additions
and
52 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
/* @flow */ | ||
import React, { PureComponent } from 'react'; | ||
import { Provider } from 'react-redux'; | ||
|
||
import store, { restore } from './store'; | ||
|
||
import LoadingScreen from './start/LoadingScreen'; | ||
import Providers from './Providers'; | ||
|
||
export default class StoreHydrator extends PureComponent { | ||
state: { | ||
isHydrated: boolean, | ||
}; | ||
|
||
state = { | ||
isHydrated: false, | ||
}; | ||
|
||
componentWillMount() { | ||
restore(() => { | ||
this.setState({ isHydrated: true }); | ||
}); | ||
} | ||
|
||
render() { | ||
const { isHydrated } = this.state; | ||
|
||
if (!isHydrated) { | ||
return <LoadingScreen />; | ||
} | ||
|
||
return ( | ||
<Provider store={store}> | ||
<Providers /> | ||
</Provider> | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters