From d6bf24902a34f2094363121c8d9f4d54db6f7b6c Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Fri, 28 Apr 2017 23:28:27 +0200 Subject: implement new reserve creation dialog and auditor management --- src/components.ts | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) (limited to 'src/components.ts') 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 { * but has multiple state holders. */ export abstract class ImplicitStateComponent extends React.Component { + _implicit = {needsUpdate: false, didMount: false}; + componentDidMount() { + this._implicit.didMount = true; + if (this._implicit.needsUpdate) { + this.setState({} as any); + } + } makeState(initial: StateType): StateHolder { 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; }; -- cgit v1.2.3