diff options
Diffstat (limited to 'pages/confirm-contract.tsx')
-rw-r--r-- | pages/confirm-contract.tsx | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/pages/confirm-contract.tsx b/pages/confirm-contract.tsx index 5867051ac..91f4c2e82 100644 --- a/pages/confirm-contract.tsx +++ b/pages/confirm-contract.tsx @@ -44,20 +44,28 @@ interface DetailProps { class Details extends preact.Component<DetailProps, DetailState> { constructor(props: DetailProps) { super(props); - this.state = { + this.setState({ collapsed: props.collapsed, exchanges: null - }; + }); + + console.log("initial state:", this.state); this.update(); } + componentWillReceiveProps(props: DetailProps) { + this.setState({collapsed: props.collapsed} as any); + } + async update() { let exchanges = await getExchanges(); this.setState({exchanges} as any); } render(props: DetailProps, state: DetailState) { + console.log("details collapsed (state)", state.collapsed); + console.log("details collapsed (prop)", props.collapsed); if (state.collapsed) { return ( <div> @@ -141,7 +149,7 @@ class ContractPrompt extends preact.Component<ContractPromptProps, ContractPromp this.state.payDisabled = false; this.state.error = null; } - this.forceUpdate(); + this.setState({} as any); window.setTimeout(() => this.checkPayment(), 300); }); } |