Skip to content

Commit

Permalink
Only cache non-alias dashboards
Browse files Browse the repository at this point in the history
  • Loading branch information
Heenawter committed Jan 25, 2024
1 parent 1d2dc7c commit 1a721e0
Showing 1 changed file with 9 additions and 3 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const loadDashboardState = async ({

const cachedDashboard = dashboardContentManagementCache.fetchDashboard(id);
if (cachedDashboard) {
console.log('cached dashboard', cachedDashboard);
/** If the dashboard exists in the cache, use the cached version to load the dashboard */
({ item: rawDashboardContent, meta: resolveMeta } = cachedDashboard);
} else {
Expand All @@ -80,8 +81,14 @@ export const loadDashboardState = async ({
.catch((e) => {
throw new SavedObjectNotFound(DASHBOARD_CONTENT_ID, id);
});

dashboardContentManagementCache.addDashboard(result);
const { outcome: loadOutcome } = result.meta;
if (loadOutcome !== 'aliasMatch') {
/**
* Only add the dashboard to the cache if it does not require a redirect - otherwise, the meta
* alias info gets cached and prevents the dashboard contents from being updated
*/
dashboardContentManagementCache.addDashboard(result);
}
({ item: rawDashboardContent, meta: resolveMeta } = result);
}

Expand Down Expand Up @@ -160,7 +167,6 @@ export const loadDashboardState = async ({
{
...DEFAULT_DASHBOARD_INPUT,
...options,

id: embeddableId,
refreshInterval,
timeRestore,
Expand Down

0 comments on commit 1a721e0

Please sign in to comment.