prevent race condition where we can accept tip before the background page knows about it
This commit is contained in:
parent
3570e36baa
commit
6533716fac
@ -2801,6 +2801,7 @@ export class Wallet {
|
|||||||
let merchantResp;
|
let merchantResp;
|
||||||
|
|
||||||
tipRecord = await this.q().putOrGetExisting(Stores.tips, tipRecord, [tipRecord.tipId, merchantDomain]);
|
tipRecord = await this.q().putOrGetExisting(Stores.tips, tipRecord, [tipRecord.tipId, merchantDomain]);
|
||||||
|
this.notifier.notify();
|
||||||
|
|
||||||
// Planchets in the form that the merchant expects
|
// Planchets in the form that the merchant expects
|
||||||
const planchetsDetail: TipPlanchetDetail[] = tipRecord.planchets.map((p) => ({
|
const planchetsDetail: TipPlanchetDetail[] = tipRecord.planchets.map((p) => ({
|
||||||
@ -2846,6 +2847,7 @@ export class Wallet {
|
|||||||
tipRecord.pickedUp = true;
|
tipRecord.pickedUp = true;
|
||||||
|
|
||||||
await this.q().put(Stores.tips, tipRecord).finish();
|
await this.q().put(Stores.tips, tipRecord).finish();
|
||||||
|
this.notifier.notify();
|
||||||
|
|
||||||
return tipRecord;
|
return tipRecord;
|
||||||
}
|
}
|
||||||
|
@ -127,7 +127,7 @@ class TipDisplay extends React.Component<TipDisplayProps, TipDisplayState> {
|
|||||||
<button
|
<button
|
||||||
className="pure-button pure-button-primary"
|
className="pure-button pure-button-primary"
|
||||||
type="button"
|
type="button"
|
||||||
disabled={!(this.state.rci && this.state.tipStatus)}
|
disabled={!(this.state.rci && this.state.tipStatus && this.state.tipStatus.tipRecord)}
|
||||||
onClick={() => this.accept()}>
|
onClick={() => this.accept()}>
|
||||||
{ this.state.working
|
{ this.state.working
|
||||||
? <span><object className="svg-icon svg-baseline" data="/img/spinner-bars.svg" /> </span>
|
? <span><object className="svg-icon svg-baseline" data="/img/spinner-bars.svg" /> </span>
|
||||||
|
Loading…
Reference in New Issue
Block a user