Skip to content

Commit

Permalink
Fix stale execution context (#778)
Browse files Browse the repository at this point in the history
  • Loading branch information
broody authored Sep 25, 2024
1 parent 1c5244e commit 3446f22
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions packages/keychain/src/components/ExecutionContainer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,7 @@ export function ExecutionContainer({
setCtrlError(error);
} finally {
setIsLoading(false);
setMaxFee(null);
}
};

Expand Down
3 changes: 2 additions & 1 deletion packages/keychain/src/hooks/connection.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,11 +67,12 @@ export function useConnectionValue() {
code: ResponseCodes.CANCELED,
message: "User aborted",
});
setContext(undefined); // clears context
await parent.close();
} catch (e) {
// Always fails for some reason
}
}, [context, parent]);
}, [context, parent, setContext]);

const openModal = useCallback(async () => {
if (!parent) return;
Expand Down
3 changes: 2 additions & 1 deletion packages/keychain/src/utils/connection/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,8 @@ export type ConnectionCtx =
| LogoutCtx
| ExecuteCtx
| SignMessageCtx
| OpenSettingsCtx;
| OpenSettingsCtx
| undefined;

export type ConnectCtx = {
origin: string;
Expand Down

0 comments on commit 3446f22

Please sign in to comment.