Skip to content
This repository has been archived by the owner on Aug 16, 2024. It is now read-only.

Commit

Permalink
Add reset to contractupdate
Browse files Browse the repository at this point in the history
  • Loading branch information
bisgardo committed Jul 7, 2023
1 parent f0eef5a commit a71f1a2
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions samples/contractupdate/src/ContractInvoker.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,13 @@ export function ContractInvoker({ rpc, network, connection, connectedAccount, co

const [isAwaitingApproval, setIsAwaitingApproval] = useState(false);
const [submittedTxHash, setSubmittedTxHash] = useState<Result<string, string>>();

// Reset 'isAwaitingApproval' and 'submittedTxHash' whenever connection changes.
useEffect(() => {
setSubmittedTxHash(undefined);
setIsAwaitingApproval(false);
}, [connection]);

const submit = useCallback(() => {
if (connection && connectedAccount) {
setIsAwaitingApproval(true);
Expand Down

0 comments on commit a71f1a2

Please sign in to comment.