Skip to content

Commit

Permalink
Update welcome banner state after red bubble slugs load
Browse files Browse the repository at this point in the history
  • Loading branch information
CodeyGuyDylan committed Mar 7, 2025
1 parent c56a188 commit 6d40418
Showing 1 changed file with 12 additions and 1 deletion.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { __ } from '@wordpress/i18n';
import { useCallback, useMemo } from 'react';
import { useCallback, useMemo, useEffect } from 'react';
import { useValueStore } from '../../context/value-store/valueStoreContext';
import {
QUERY_DISMISS_WELCOME_BANNER_KEY,
Expand Down Expand Up @@ -32,6 +32,17 @@ const useWelcomeBanner = () => {
redBubbleAlertKeys.includes( 'welcome-banner-active' )
);

useEffect( () => {
if ( ! isRedBubbleAlertsLoading && ! isRedBubbleAlertsError ) {
setIsWelcomeBannerVisible( redBubbleAlertKeys.includes( 'welcome-banner-active' ) );
}
}, [
isRedBubbleAlertsError,
isRedBubbleAlertsLoading,
redBubbleAlertKeys,
setIsWelcomeBannerVisible,
] );

const { mutate: handleDismissWelcomeBanner } = useSimpleMutation( {
name: QUERY_DISMISS_WELCOME_BANNER_KEY,
query: {
Expand Down

0 comments on commit 6d40418

Please sign in to comment.