mirror of
https://github.com/GoogleChromeLabs/squoosh.git
synced 2025-11-15 01:59:57 +00:00
In development, persist application state across hot reloads.
This commit is contained in:
@@ -36,6 +36,17 @@ export default class App extends Component<Props, State> {
|
||||
|
||||
enableDrawer = false;
|
||||
|
||||
constructor() {
|
||||
super();
|
||||
// In development, persist application state across hot reloads:
|
||||
if (process.env.NODE_ENV === 'development') {
|
||||
this.setState(window.STATE);
|
||||
this.componentDidUpdate = () => {
|
||||
window.STATE = this.state;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
@bind
|
||||
openDrawer() {
|
||||
this.setState({ showDrawer: true });
|
||||
|
||||
Reference in New Issue
Block a user