diff --git a/openmetadata-ui/src/main/resources/ui/src/App.tsx b/openmetadata-ui/src/main/resources/ui/src/App.tsx index cbcc1eaef49..a511d1c4004 100644 --- a/openmetadata-ui/src/main/resources/ui/src/App.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/App.tsx @@ -30,6 +30,7 @@ import PermissionProvider from './context/PermissionProvider/PermissionProvider' import TourProvider from './context/TourProvider/TourProvider'; import WebSocketProvider from './context/WebSocketProvider/WebSocketProvider'; import { useApplicationStore } from './hooks/useApplicationStore'; +import { useWelcomeStore } from './hooks/useWelcomeStore'; import { getCustomUiThemePreference } from './rest/settingConfigAPI'; import { history } from './utils/HistoryUtils'; import i18n from './utils/i18next/LocalUtil'; @@ -37,6 +38,7 @@ import { getThemeConfig } from './utils/ThemeUtils'; const App: FC = () => { const { applicationConfig, setApplicationConfig } = useApplicationStore(); + const { setIsWelcomeVisible } = useWelcomeStore(); const fetchApplicationConfig = async () => { try { @@ -54,6 +56,7 @@ const App: FC = () => { useEffect(() => { fetchApplicationConfig(); + setIsWelcomeVisible(true); }, []); useEffect(() => { diff --git a/openmetadata-ui/src/main/resources/ui/src/hooks/useWelcomeStore.ts b/openmetadata-ui/src/main/resources/ui/src/hooks/useWelcomeStore.ts new file mode 100644 index 00000000000..e2d0ffca19f --- /dev/null +++ b/openmetadata-ui/src/main/resources/ui/src/hooks/useWelcomeStore.ts @@ -0,0 +1,25 @@ +/* + * Copyright 2025 Collate. + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * http://www.apache.org/licenses/LICENSE-2.0 + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +import { create } from 'zustand'; + +interface WelcomeStore { + isWelcomeVisible: boolean; + setIsWelcomeVisible: (isVisible: boolean) => void; +} + +export const useWelcomeStore = create()((set) => ({ + isWelcomeVisible: false, + setIsWelcomeVisible: (isVisible: boolean) => { + set({ isWelcomeVisible: isVisible }); + }, +})); diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/MyDataPage/MyDataPage.component.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/MyDataPage/MyDataPage.component.tsx index 55565b68380..b364fa26f03 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/MyDataPage/MyDataPage.component.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/MyDataPage/MyDataPage.component.tsx @@ -38,6 +38,7 @@ import { EntityReference } from '../../generated/type/entityReference'; import LimitWrapper from '../../hoc/LimitWrapper'; import { useApplicationStore } from '../../hooks/useApplicationStore'; import { useGridLayoutDirection } from '../../hooks/useGridLayoutDirection'; +import { useWelcomeStore } from '../../hooks/useWelcomeStore'; import { getDocumentByFQN } from '../../rest/DocStoreAPI'; import { getActiveAnnouncement } from '../../rest/feedsAPI'; import { searchQuery } from '../../rest/searchAPI'; @@ -52,6 +53,7 @@ const ReactGridLayout = WidthProvider(RGL); const MyDataPage = () => { const { t } = useTranslation(); const { currentUser, selectedPersona } = useApplicationStore(); + const { isWelcomeVisible } = useWelcomeStore(); const [followedData, setFollowedData] = useState>([]); const [followedDataCount, setFollowedDataCount] = useState(0); const [isLoadingOwnedData, setIsLoadingOwnedData] = useState(false); @@ -117,7 +119,7 @@ const MyDataPage = () => { useEffect(() => { isMounted.current = true; - updateWelcomeScreen(!usernameExistsInCookie); + updateWelcomeScreen(!usernameExistsInCookie && isWelcomeVisible); return () => updateWelcomeScreen(false); }, []); diff --git a/openmetadata-ui/src/main/resources/ui/src/pages/MyDataPage/MyDataPage.test.tsx b/openmetadata-ui/src/main/resources/ui/src/pages/MyDataPage/MyDataPage.test.tsx index 44c1cbf0f70..186ad58da6a 100644 --- a/openmetadata-ui/src/main/resources/ui/src/pages/MyDataPage/MyDataPage.test.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/pages/MyDataPage/MyDataPage.test.tsx @@ -145,6 +145,12 @@ jest.mock('../DataInsightPage/DataInsightProvider', async () => { return jest.fn().mockImplementation(({ children }) => <>{children}); }); +jest.mock('../../hooks/useWelcomeStore', () => ({ + useWelcomeStore: jest.fn().mockReturnValue({ + isWelcomeVisible: true, + }), +})); + jest.mock('../DataInsightPage/DataInsightProvider', () => { return { __esModule: true,