This commit is contained in:
Florian Dold 2016-10-19 23:27:46 +02:00
parent 6a11b512b3
commit 9fbf208aab
2 changed files with 13 additions and 4 deletions

View File

@ -44,20 +44,28 @@ interface DetailProps {
class Details extends preact.Component<DetailProps, DetailState> { class Details extends preact.Component<DetailProps, DetailState> {
constructor(props: DetailProps) { constructor(props: DetailProps) {
super(props); super(props);
this.state = { this.setState({
collapsed: props.collapsed, collapsed: props.collapsed,
exchanges: null exchanges: null
}; });
console.log("initial state:", this.state);
this.update(); this.update();
} }
componentWillReceiveProps(props: DetailProps) {
this.setState({collapsed: props.collapsed} as any);
}
async update() { async update() {
let exchanges = await getExchanges(); let exchanges = await getExchanges();
this.setState({exchanges} as any); this.setState({exchanges} as any);
} }
render(props: DetailProps, state: DetailState) { render(props: DetailProps, state: DetailState) {
console.log("details collapsed (state)", state.collapsed);
console.log("details collapsed (prop)", props.collapsed);
if (state.collapsed) { if (state.collapsed) {
return ( return (
<div> <div>
@ -141,7 +149,7 @@ class ContractPrompt extends preact.Component<ContractPromptProps, ContractPromp
this.state.payDisabled = false; this.state.payDisabled = false;
this.state.error = null; this.state.error = null;
} }
this.forceUpdate(); this.setState({} as any);
window.setTimeout(() => this.checkPayment(), 300); window.setTimeout(() => this.checkPayment(), 300);
}); });
} }

View File

@ -217,7 +217,8 @@ class WalletBalanceView extends preact.Component<any, any> {
help help
</ExtensionLink> </ExtensionLink>
); );
return <div>You have no balance to show. Need some {helpLink} return <div>You have no balance to show. Need some
{" "}{helpLink}{" "}
getting started?</div>; getting started?</div>;
} }