Page MenuHomePhabricator

D4812.diff
No OneTemporary

D4812.diff

diff --git a/keyserver/src/responders/website-responders.js b/keyserver/src/responders/website-responders.js
--- a/keyserver/src/responders/website-responders.js
+++ b/keyserver/src/responders/website-responders.js
@@ -330,6 +330,7 @@
deviceToken: undefined,
dataLoaded: viewer.loggedIn,
windowActive: true,
+ _persist: null,
};
const [stateResult, App] = await Promise.all([
diff --git a/web/redux/redux-setup.js b/web/redux/redux-setup.js
--- a/web/redux/redux-setup.js
+++ b/web/redux/redux-setup.js
@@ -1,6 +1,7 @@
// @flow
import invariant from 'invariant';
+import type { PersistState } from 'redux-persist/src/types';
import {
logOutActionTypes,
@@ -57,6 +58,7 @@
userAgent: ?string,
dataLoaded: boolean,
windowActive: boolean,
+ _persist: ?PersistState,
};
export const updateWindowDimensions = 'UPDATE_WINDOW_DIMENSIONS';
diff --git a/web/root.js b/web/root.js
--- a/web/root.js
+++ b/web/root.js
@@ -4,6 +4,9 @@
import { Provider } from 'react-redux';
import { createStore, applyMiddleware, type Store } from 'redux';
import { composeWithDevTools } from 'redux-devtools-extension/logOnlyInProduction';
+import { persistReducer, persistStore } from 'redux-persist';
+import { PersistGate } from 'redux-persist/integration/react';
+import storage from 'redux-persist/lib/storage';
import thunk from 'redux-thunk';
import { reduxLoggerMiddleware } from 'lib/utils/action-logger';
@@ -12,16 +15,27 @@
import { reducer } from './redux/redux-setup';
import type { AppState, Action } from './redux/redux-setup';
+const persistConfig = {
+ key: 'root',
+ storage,
+ whitelist: ['enabledApps'],
+ version: 0,
+};
+
declare var preloadedState: AppState;
+const persistedReducer = persistReducer(persistConfig, reducer);
const store: Store<AppState, Action> = createStore(
- reducer,
+ persistedReducer,
preloadedState,
composeWithDevTools({})(applyMiddleware(thunk, reduxLoggerMiddleware)),
);
+const persistor = persistStore(store);
const RootProvider = (): React.Node => (
<Provider store={store}>
- <HotRoot />
+ <PersistGate persistor={persistor}>
+ <HotRoot />
+ </PersistGate>
</Provider>
);

File Metadata

Mime Type
text/plain
Expires
Wed, Nov 27, 1:20 PM (21 h, 55 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2590527
Default Alt Text
D4812.diff (2 KB)

Event Timeline