@@ -40,6 +40,7 @@ import {
4040} from '@stripe/react-connect-js' ;
4141import { recordEvent } from 'wcpay/tracks' ;
4242import StripeSpinner from 'wcpay/components/stripe-spinner' ;
43+ import { getAdminUrl } from 'wcpay/utils' ;
4344
4445const OverviewPageError = ( ) => {
4546 const queryParams = getQuery ( ) ;
@@ -98,6 +99,11 @@ const OverviewPage = () => {
9899 const [ stripeComponentLoading , setStripeComponentLoading ] = useState (
99100 true
100101 ) ;
102+ // Variable to memoize the count of Stripe notifications.
103+ const [
104+ stripeNotificationsCountToAddressMemo ,
105+ setStripeNotificationsCountToAddressMemo ,
106+ ] = useState ( 0 ) ;
101107
102108 const isTestModeOnboarding = wcpaySettings . testModeOnboarding ;
103109 const { isLoading : settingsIsLoading } = useSettings ( ) ;
@@ -216,6 +222,28 @@ const OverviewPage = () => {
216222 // Do something related to notifications that don't require action.
217223 setNotificationsBannerMessage ( 'The items below are in review.' ) ;
218224 } else {
225+ // This is the case where we addressed everything and previously had some notifications to address.
226+ // We recommend the merchant to reload the page in this case.
227+ if ( stripeNotificationsCountToAddressMemo > 0 ) {
228+ dispatch ( 'core/notices' ) . createSuccessNotice (
229+ __ (
230+ 'Updates take a moment to appear. Please refresh the page in a minute.' ,
231+ 'woocommerce-payments'
232+ ) ,
233+ {
234+ actions : [
235+ {
236+ label : __ ( 'Refresh' , 'woocommerce-payments' ) ,
237+ url : getAdminUrl ( {
238+ page : 'wc-admin' ,
239+ path : '/payments/overview' ,
240+ } ) ,
241+ } ,
242+ ] ,
243+ explicitDismiss : true ,
244+ }
245+ ) ;
246+ }
219247 setNotificationsBannerMessage ( '' ) ;
220248 }
221249 if ( response . actionRequired > 0 || response . total > 0 ) {
@@ -224,6 +252,8 @@ const OverviewPage = () => {
224252 action_required_count : response . actionRequired ,
225253 total_count : response . total ,
226254 } ) ;
255+ // Memoize the notifications count to be able to compare it with the fresh count when this function is called one more time.
256+ setStripeNotificationsCountToAddressMemo ( response . total ) ;
227257 }
228258 // If the component inits successfully, this function is always called.
229259 // It's safe to set the loading false here rather than onLoaderStart, because it happens too early and the UX is not smooth.
0 commit comments