Skip to content

Commit

Permalink
update the query cache on mount
Browse files Browse the repository at this point in the history
  • Loading branch information
thmsobrmlr committed Nov 2, 2023
1 parent b077b31 commit 14a558f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion frontend/src/scenes/insights/InsightNav/insightNavLogic.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { actions, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'

import { InsightLogicProps, InsightType, ActionFilter } from '~/types'
import type { insightNavLogicType } from './insightNavLogicType'
Expand Down Expand Up @@ -240,6 +240,11 @@ export const insightNavLogic = kea<insightNavLogicType>([
}
},
})),
afterMount(({ values, actions }) => {
if (values.query && isInsightVizNode(values.query)) {
actions.updateQueryPropertyCache(cachePropertiesFromQuery(values.query.source, values.queryPropertyCache))
}
}),
])

const cachePropertiesFromQuery = (query: InsightQueryNode, cache: QueryPropertyCache | null): QueryPropertyCache => {
Expand Down

0 comments on commit 14a558f

Please sign in to comment.