Restart after changing settings
Summary: Gets flipper to restart when settings are updated. In theory most settings should not need this, but the current only one does (android home) because the path is set at startup only, and this modifies the input to it. It would be a bit awkward to modify the path more than once, but doable. Reviewed By: passy Differential Revision: D17737582 fbshipit-source-id: d4669dcc7acc95469f15783fc6a5ba6794750234
This commit is contained in:
committed by
Facebook Github Bot
parent
729e74f2fc
commit
b50aef8f15
20
src/utils/persistor.tsx
Normal file
20
src/utils/persistor.tsx
Normal file
@@ -0,0 +1,20 @@
|
||||
/**
|
||||
* Copyright 2018-present Facebook.
|
||||
* This source code is licensed under the MIT license found in the
|
||||
* LICENSE file in the root directory of this source tree.
|
||||
* @format
|
||||
*/
|
||||
|
||||
import {Persistor} from 'redux-persist';
|
||||
|
||||
let _persistor: Persistor | null = null;
|
||||
|
||||
export function setPersistor(persistor: Persistor) {
|
||||
_persistor = persistor;
|
||||
}
|
||||
|
||||
export function flush(): Promise<void> {
|
||||
return _persistor
|
||||
? _persistor.flush()
|
||||
: Promise.reject(new Error('Persistor not set.'));
|
||||
}
|
||||
Reference in New Issue
Block a user