From 3be2d392db115b89b8f83255fb077fbf59a5653c Mon Sep 17 00:00:00 2001 From: Sean Li Date: Fri, 29 Mar 2024 13:50:49 -0700 Subject: [PATCH] Correctly Utilize Cache in Tables Flyout (#1662) * correctly check for cache on table flyout Signed-off-by: Sean Li * skip start loading if fail Signed-off-by: Sean Li --------- Signed-off-by: Sean Li --- .../associated_objects_details_flyout.tsx | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx b/public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx index bd230df12..8b2ce15e8 100644 --- a/public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx +++ b/public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx @@ -226,7 +226,21 @@ export const AssociatedObjectsDetailsFlyout = ({ useEffect(() => { if (tableDetail && !tableDetail.columns) { - startLoading(datasourceName, tableDetail.database, tableDetail.name); + try { + const tables = CatalogCacheManager.getTable( + datasourceName, + tableDetail.database, + tableDetail.name + ); + if (tables?.columns) { + setTableColumns(tables?.columns); + } else { + startLoading(datasourceName, tableDetail.database, tableDetail.name); + } + } catch (error) { + console.error(error); + setToast('Your cache is outdated, refresh databases and tables', 'warning'); + } } else if (tableDetail && tableDetail.columns) { setTableColumns(tableDetail.columns); }