From 0fcdceb6a7af94d6ffe14d80f7e787bdcfb2d949 Mon Sep 17 00:00:00 2001 From: Zvonimir Maglica Date: Fri, 20 Dec 2024 10:25:05 +0100 Subject: [PATCH 1/3] Invalidate transactions store when transaction is captured --- client/data/authorizations/actions.ts | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/client/data/authorizations/actions.ts b/client/data/authorizations/actions.ts index 0885da1cbfe..ace7f3c6fed 100644 --- a/client/data/authorizations/actions.ts +++ b/client/data/authorizations/actions.ts @@ -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', From bc58387180734e9fa3b01f4168bb97e826ee2374 Mon Sep 17 00:00:00 2001 From: Zvonimir Maglica Date: Fri, 20 Dec 2024 10:29:52 +0100 Subject: [PATCH 2/3] Added changelog --- changelog/fix-9735-render-transactions-correctly-on-capture | 4 ++++ 1 file changed, 4 insertions(+) create mode 100644 changelog/fix-9735-render-transactions-correctly-on-capture diff --git a/changelog/fix-9735-render-transactions-correctly-on-capture b/changelog/fix-9735-render-transactions-correctly-on-capture new file mode 100644 index 00000000000..9ed7f628e4c --- /dev/null +++ b/changelog/fix-9735-render-transactions-correctly-on-capture @@ -0,0 +1,4 @@ +Significance: patch +Type: fix + +Ensure captured transactions appear in the Transactions tab without requiring a page refresh. From 2ab60e15338ce1690a3c8984e8a6b13abd1a3771 Mon Sep 17 00:00:00 2001 From: Zvonimir Maglica Date: Fri, 20 Dec 2024 10:47:47 +0100 Subject: [PATCH 3/3] Fixed tests --- client/data/authorizations/test/actions.test.ts | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/client/data/authorizations/test/actions.test.ts b/client/data/authorizations/test/actions.test.ts index 171ef6dd5ad..36527d1836a 100644 --- a/client/data/authorizations/test/actions.test.ts +++ b/client/data/authorizations/test/actions.test.ts @@ -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',