- constructor(public appRef: ApplicationRef, public appState: AppState) {}
- hmrOnInit(store) {
- if (!store || !store.state) return;
- console.log('HMR store', store);
- this.appState._state = store.state;
- this.appRef.tick();
- delete store.state;
+ constructor (
+ public appRef: ApplicationRef,
+ public appState: AppState
+ ) {}
+
+ public hmrOnInit (store: StoreType) {
+ if (!store || !store.state) {
+ return
+ }
+ console.log('HMR store', JSON.stringify(store, null, 2))
+ /**
+ * Set state
+ */
+ this.appState._state = store.state
+ /**
+ * Set input values
+ */
+ if ('restoreInputValues' in store) {
+ let restoreInputValues = store.restoreInputValues
+ setTimeout(restoreInputValues)
+ }
+
+ this.appRef.tick()
+ delete store.state
+ delete store.restoreInputValues