mirror of
https://github.com/ascribe/onion.git
synced 2025-01-03 18:35:09 +01:00
Merged in AD-610-on-switching-edition-detail-coa-d (pull request #17)
Flush store after unmounting coa component to force refresh on new user request
This commit is contained in:
commit
90b0047eb8
@ -7,7 +7,8 @@ import CoaFetcher from '../fetchers/coa_fetcher';
|
||||
class CoaActions {
|
||||
constructor() {
|
||||
this.generateActions(
|
||||
'updateCoa'
|
||||
'updateCoa',
|
||||
'flushCoa'
|
||||
);
|
||||
}
|
||||
|
||||
@ -26,9 +27,7 @@ class CoaActions {
|
||||
this.actions.updateCoa(res.coa);
|
||||
})
|
||||
.catch((err) => {
|
||||
console.log(err)
|
||||
console.logGlobal(err);
|
||||
this.actions.updateCoa('Something went wrong, please try again later.');
|
||||
});
|
||||
}
|
||||
}
|
||||
|
@ -400,6 +400,9 @@ let CoaDetails = React.createClass({
|
||||
},
|
||||
|
||||
componentWillUnmount() {
|
||||
// Flushing the coa state is essential to not displaying the same
|
||||
// data to the user while he's on another edition
|
||||
CoaActions.flushCoa();
|
||||
CoaStore.unlisten(this.onChange);
|
||||
},
|
||||
|
||||
@ -426,8 +429,7 @@ let CoaDetails = React.createClass({
|
||||
</p>
|
||||
</div>
|
||||
);
|
||||
}
|
||||
else if (typeof this.state.coa === 'string'){
|
||||
} else if(typeof this.state.coa === 'string'){
|
||||
return (
|
||||
<div className="text-center">
|
||||
{this.state.coa}
|
||||
|
@ -13,9 +13,9 @@ class CoaStore {
|
||||
onUpdateCoa(coa) {
|
||||
this.coa = coa;
|
||||
}
|
||||
onErrorCoa(err) {
|
||||
|
||||
onFlushCoa() {
|
||||
this.coa = {};
|
||||
//this.coa = err
|
||||
}
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user