From 3772ca5dc34cf152a657dd8b3a262bf9e39f4a0b Mon Sep 17 00:00:00 2001 From: darth-coder00 <86726556+darth-coder00@users.noreply.github.com> Date: Wed, 20 Apr 2022 02:20:42 +0530 Subject: [PATCH] Fixed #4203: Do not show empty items in Recent Views (#4245) --- .../recently-viewed/RecentlyViewed.tsx | 20 ++++++++++--------- .../resources/ui/src/constants/constants.ts | 2 +- 2 files changed, 12 insertions(+), 10 deletions(-) diff --git a/openmetadata-ui/src/main/resources/ui/src/components/recently-viewed/RecentlyViewed.tsx b/openmetadata-ui/src/main/resources/ui/src/components/recently-viewed/RecentlyViewed.tsx index 9fb050b9315..18e5ea27b27 100644 --- a/openmetadata-ui/src/main/resources/ui/src/components/recently-viewed/RecentlyViewed.tsx +++ b/openmetadata-ui/src/main/resources/ui/src/components/recently-viewed/RecentlyViewed.tsx @@ -25,15 +25,17 @@ const RecentlyViewed: FunctionComponent = () => { const prepareData = () => { if (recentlyViewedData.length) { setIsloading(true); - const formatedData = recentlyViewedData.map((data) => { - return { - serviceType: data.serviceType, - name: data.displayName || prepareLabel(data.entityType, data.fqn), - fullyQualifiedName: data.fqn, - index: data.entityType, - }; - }); - setData(formatedData as unknown as FormatedTableData[]); + const formattedData = recentlyViewedData + .map((item) => { + return { + serviceType: item.serviceType, + name: item.displayName || prepareLabel(item.entityType, item.fqn), + fullyQualifiedName: item.fqn, + index: item.entityType, + }; + }) + .filter((item) => item.name); + setData(formattedData as unknown as FormatedTableData[]); setIsloading(false); } }; diff --git a/openmetadata-ui/src/main/resources/ui/src/constants/constants.ts b/openmetadata-ui/src/main/resources/ui/src/constants/constants.ts index 4dec813ea71..92e907f60a4 100644 --- a/openmetadata-ui/src/main/resources/ui/src/constants/constants.ts +++ b/openmetadata-ui/src/main/resources/ui/src/constants/constants.ts @@ -21,7 +21,7 @@ export const API_RES_MAX_SIZE = 100000; export const LIST_SIZE = 5; export const SIDEBAR_WIDTH_COLLAPSED = 290; export const SIDEBAR_WIDTH_EXPANDED = 290; -export const LOCALSTORAGE_RECENTLY_VIEWED = 'recentlyViewedData'; +export const LOCALSTORAGE_RECENTLY_VIEWED = `recentlyViewedData_${COOKIE_VERSION}`; export const LOCALSTORAGE_RECENTLY_SEARCHED = `recentlySearchedData_${COOKIE_VERSION}`; export const oidcTokenKey = 'oidcIdToken'; export const isAdminUpdated = 'isAdminUpdated';