Skip to content

Commit

Permalink
Correctly Utilize Cache in Tables Flyout (opensearch-project#1662) (o…
Browse files Browse the repository at this point in the history
…pensearch-project#1663)

* correctly check for cache on table flyout



* skip start loading if fail



---------


(cherry picked from commit 3be2d39)

Signed-off-by: Sean Li <lnse@amazon.com>
Signed-off-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
  • Loading branch information
1 parent a63e964 commit edda14e
Showing 1 changed file with 15 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}
Expand Down

0 comments on commit edda14e

Please sign in to comment.