-
-
Notifications
You must be signed in to change notification settings - Fork 651
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
diagnostics: Re-add timer for store hydration.
The store hydration timer got removed in bf659a2 when we upgraded from redux-persist v4 to v5 due to structural differences in the redux initialization. Re-add a timer. Do this with a new, reusable Timer component that logs the duration of its existence to timing.js. This works for roughly measuring the redux-persist execution time, because that's all the app is doing while the loading screen is shown. No other big actions distort this measurement, because no significant actions are dispatched as long as the state is not properly loaded.
- Loading branch information
1 parent
a954500
commit e7610ca
Showing
2 changed files
with
33 additions
and
1 deletion.
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,24 @@ | ||
/* @flow */ | ||
import { PureComponent } from 'react'; | ||
|
||
import type { ChildrenArray } from '../types'; | ||
import timing from '../utils/timing'; | ||
|
||
type Props = { | ||
children: ChildrenArray<*>, | ||
name: string, | ||
}; | ||
|
||
export default class RenderTimer extends PureComponent<Props> { | ||
componentDidMount() { | ||
timing.start(this.props.name); | ||
} | ||
|
||
componentWillUnmount() { | ||
timing.end(this.props.name); | ||
} | ||
|
||
render() { | ||
return this.props.children; | ||
} | ||
} |