aboutsummaryrefslogtreecommitdiff
path: root/src/components.ts
diff options
context:
space:
mode:
authorFlorian Dold <florian.dold@gmail.com>2017-04-28 23:28:27 +0200
committerFlorian Dold <florian.dold@gmail.com>2017-04-28 23:28:27 +0200
commitd6bf24902a34f2094363121c8d9f4d54db6f7b6c (patch)
tree0794956ebdf91a2fbea16baa0e8aa559f45c5d06 /src/components.ts
parentce97b1076b7e4a53b84d3fd34bf2047580ddeb22 (diff)
downloadwallet-core-d6bf24902a34f2094363121c8d9f4d54db6f7b6c.tar.xz
implement new reserve creation dialog and auditor management
Diffstat (limited to 'src/components.ts')
-rw-r--r--src/components.ts13
1 files changed, 12 insertions, 1 deletions
diff --git a/src/components.ts b/src/components.ts
index 4ed746f67..569810f3a 100644
--- a/src/components.ts
+++ b/src/components.ts
@@ -33,12 +33,23 @@ export interface StateHolder<T> {
* but has multiple state holders.
*/
export abstract class ImplicitStateComponent<PropType> extends React.Component<PropType, any> {
+ _implicit = {needsUpdate: false, didMount: false};
+ componentDidMount() {
+ this._implicit.didMount = true;
+ if (this._implicit.needsUpdate) {
+ this.setState({} as any);
+ }
+ }
makeState<StateType>(initial: StateType): StateHolder<StateType> {
let state: StateType = initial;
return (s?: StateType): StateType => {
if (s !== undefined) {
state = s;
- this.setState({} as any);
+ if (this._implicit.didMount) {
+ this.setState({} as any);
+ } else {
+ this._implicit.needsUpdate = true;
+ }
}
return state;
};