@@ -8,7 +8,12 @@ import {
88} from "constants/ReduxActionConstants" ;
99
1010import { fetchEditorConfigs } from "actions/configsActions" ;
11- import { fetchPage , fetchPageList , setAppMode } from "actions/pageActions" ;
11+ import {
12+ fetchPage ,
13+ fetchPageList ,
14+ setAppMode ,
15+ updateAppStore ,
16+ } from "actions/pageActions" ;
1217import { fetchDatasources } from "actions/datasourceActions" ;
1318import { fetchPlugins } from "actions/pluginActions" ;
1419import { fetchActions , fetchActionsForView } from "actions/actionActions" ;
@@ -20,6 +25,19 @@ import PageApi, { FetchPageResponse } from "api/PageApi";
2025import { validateResponse } from "./ErrorSagas" ;
2126import { extractCurrentDSL } from "utils/WidgetPropsUtils" ;
2227import { APP_MODE } from "reducers/entityReducers/appReducer" ;
28+ import { getAppStoreName } from "constants/AppConstants" ;
29+
30+ const getAppStore = ( appId : string ) => {
31+ const appStoreName = getAppStoreName ( appId ) ;
32+ const storeString = localStorage . getItem ( appStoreName ) || "{}" ;
33+ let store ;
34+ try {
35+ store = JSON . parse ( storeString ) ;
36+ } catch ( e ) {
37+ store = { } ;
38+ }
39+ return store ;
40+ } ;
2341
2442function * initializeEditorSaga (
2543 initializeEditorAction : ReduxAction < InitializeEditorPayload > ,
@@ -52,6 +70,7 @@ function* initializeEditorSaga(
5270
5371 // Step 5: Set app mode
5472 yield put ( setAppMode ( APP_MODE . EDIT ) ) ;
73+ yield put ( updateAppStore ( getAppStore ( applicationId ) ) ) ;
5574
5675 const currentApplication = yield select ( getCurrentApplication ) ;
5776
@@ -142,6 +161,7 @@ export function* initializeAppViewerSaga(
142161 ] ) ;
143162
144163 yield put ( setAppMode ( APP_MODE . PUBLISHED ) ) ;
164+ yield put ( updateAppStore ( getAppStore ( applicationId ) ) ) ;
145165
146166 yield put ( {
147167 type : ReduxActionTypes . INITIALIZE_PAGE_VIEWER_SUCCESS ,
0 commit comments