Skip to content

Commit 31f17fe

Browse files
Correctly Utilize Cache in Tables Flyout (#1662)
* correctly check for cache on table flyout Signed-off-by: Sean Li <[email protected]> * skip start loading if fail Signed-off-by: Sean Li <[email protected]> --------- Signed-off-by: Sean Li <[email protected]> (cherry picked from commit 3be2d39) Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
1 parent 606bc71 commit 31f17fe

File tree

1 file changed

+15
-1
lines changed

1 file changed

+15
-1
lines changed

public/components/datasources/components/manage/associated_objects/associated_objects_details_flyout.tsx

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -226,7 +226,21 @@ export const AssociatedObjectsDetailsFlyout = ({
226226

227227
useEffect(() => {
228228
if (tableDetail && !tableDetail.columns) {
229-
startLoading(datasourceName, tableDetail.database, tableDetail.name);
229+
try {
230+
const tables = CatalogCacheManager.getTable(
231+
datasourceName,
232+
tableDetail.database,
233+
tableDetail.name
234+
);
235+
if (tables?.columns) {
236+
setTableColumns(tables?.columns);
237+
} else {
238+
startLoading(datasourceName, tableDetail.database, tableDetail.name);
239+
}
240+
} catch (error) {
241+
console.error(error);
242+
setToast('Your cache is outdated, refresh databases and tables', 'warning');
243+
}
230244
} else if (tableDetail && tableDetail.columns) {
231245
setTableColumns(tableDetail.columns);
232246
}

0 commit comments

Comments
 (0)