Re-render accounts in more scenarios and update onWebsocketConnectedFake

This commit is contained in:
Halla Moore 2016-07-13 14:53:56 -07:00
parent b03b8b537d
commit 0b9933b514
2 changed files with 14 additions and 3 deletions

View file

@ -41,7 +41,10 @@ class Account extends React.Component {
}
shouldComponentUpdate(nextProps) {
return nextProps.account.version !== this.props.account.version;
return nextProps.account.version !== this.props.account.version ||
nextProps.active !== this.props.account.active ||
nextProps.assignment !== this.props.assignment ||
nextProps.count !== this.props.count;
}
clearError() {

View file

@ -90,12 +90,20 @@ function onWebsocketConnectedFake(wss, ws) {
last_sync_completions: [],
created_at: "2016-07-13T00:49:25.000Z",
};
ws.send(JSON.stringify({ cmd: "ACCOUNT", payload: acct }));
ws.send(JSON.stringify({ cmd: "UPDATE", payload: {
updatedAccounts: [acct],
activeAccountIds: [],
assignments: {},
}}));
accts.push(acct);
}
setInterval(() => {
const acct = accts[Math.floor(Math.random() * accts.length)];
ws.send(JSON.stringify({ cmd: "ACCOUNT", payload: acct }));
ws.send(JSON.stringify({ cmd: "UPDATE", payload: {
updatedAccounts: [acct],
activeAccountIds: [],
assignments: {},
}}));
}, 250);
}