Skip to content

Commit

Permalink
Invalidate transactions store when transaction is captured (#10015)
Browse files Browse the repository at this point in the history
  • Loading branch information
zmaglica authored Dec 20, 2024
1 parent 779ef47 commit 3c7b115
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 0 deletions.
4 changes: 4 additions & 0 deletions changelog/fix-9735-render-transactions-correctly-on-capture
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
Significance: patch
Type: fix

Ensure captured transactions appear in the Transactions tab without requiring a page refresh.
7 changes: 7 additions & 0 deletions client/data/authorizations/actions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -196,6 +196,13 @@ export function* submitCaptureAuthorization(
'getPaymentIntent'
);

// Need to invalidate transactions tab to update newly captured transaction if needed.
yield controls.dispatch(
STORE_NAME,
'invalidateResolutionForStoreSelector',
'getTransactions'
);

// Create success notice.
yield controls.dispatch(
'core/notices',
Expand Down
8 changes: 8 additions & 0 deletions client/data/authorizations/test/actions.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -118,6 +118,14 @@ describe( 'Authorizations actions', () => {
)
);

expect( generator.next().value ).toEqual(
controls.dispatch(
'wc/payments',
'invalidateResolutionForStoreSelector',
'getTransactions'
)
);

expect( generator.next().value ).toEqual(
controls.dispatch(
'core/notices',
Expand Down

0 comments on commit 3c7b115

Please sign in to comment.