Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix(web-components): handle failed offer status updates better #63

Merged
merged 1 commit into from
Dec 5, 2023

Conversation

samsiegart
Copy link
Contributor

refs #57

Tested in a local build of dapp-inter that this fixes the issue. Will close the issue when this is published and dapp-inter and dapp-psm use the new version.

Screenshot of error properly being shown to user after fix:

image

@samsiegart samsiegart requested a review from turadg November 30, 2023 18:55
Comment on lines 232 to 234
if (!('error' in update)) {
walletUpdatesNotifierKit.updater.updateState(harden(update.value));
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

consider not inverting the condition.

Suggested change
if (!('error' in update)) {
walletUpdatesNotifierKit.updater.updateState(harden(update.value));
}
if ('error' in update) continue;
walletUpdatesNotifierKit.updater.updateState(harden(update.value));

onStatusChange({ status: 'refunded' });
return;
}
if (update.status.numWantsSatisfied === 1) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what about multiples? I think this would be future proof and safe enough:

Suggested change
if (update.status.numWantsSatisfied === 1) {
if (update.status.numWantsSatisfied > 0) {

@@ -43,33 +43,53 @@ export const makeAgoricWalletConnection = async (chainStorageWatcher, rpc) => {
}),
);

let isFinished = false;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

a little hard to follow all the reads and mutations, but I can't think of anything clearer.

@@ -17,7 +17,7 @@
"dependencies": {
"@agoric/assert": "^0.6.0",
"@agoric/cache": "^0.3.2",
"@agoric/casting": "^0.4.2",
"@agoric/casting": "0.4.3-dev-0001c49.0",
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

it would help to have some process for cleaning up dev deps whenever a new agoric-sdk release is published. maybe part of the SDK release runbook.

@samsiegart samsiegart merged commit 42625b2 into main Dec 5, 2023
1 check passed
@samsiegart samsiegart deleted the fix-offer-updates branch December 5, 2023 08:05
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants