Skip to content

Commit

Permalink
fix(web-components): fix change in update warning
Browse files Browse the repository at this point in the history
  • Loading branch information
samsiegart committed Jan 10, 2022
1 parent 174554c commit 2ee65b6
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions packages/web-components/src/AgoricWalletConnection.js
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ export const makeAgoricWalletConnection = (makeCapTP = defaultMakeCapTP) =>
// This state machine integration is much like lit-robot, but also raises
// state events.
const machine = makeConnectionMachine();
const onState = service => {
const onState = (service, requestUpdate = true) => {
this.machine = service.machine;
const ev = new CustomEvent('state', {
detail: {
Expand All @@ -122,13 +122,15 @@ export const makeAgoricWalletConnection = (makeCapTP = defaultMakeCapTP) =>
},
});
this.dispatchEvent(ev);
this.requestUpdate();
if (requestUpdate) {
this.requestUpdate();
}
};
this.service = interpret(machine, onState);
this.machine = this.service.machine;

// Wait until we load before sending the first state.
this.firstUpdated = () => onState(this.service);
this.firstUpdated = () => onState(this.service, false);

this._nextEpoch = 0;
this._bridgePK = makePromiseKit();
Expand Down

0 comments on commit 2ee65b6

Please sign in to comment.