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

Invalidate transactions store when transaction is captured #10015

Merged
merged 4 commits into from
Dec 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading