Skip to content

Commit

Permalink
fix: reload dashboard when insight updated
Browse files Browse the repository at this point in the history
  • Loading branch information
anirudhpillai committed Jul 23, 2024
1 parent b214550 commit 61d83fe
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion frontend/src/scenes/insights/insightLogic.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { featureFlagLogic } from 'lib/logic/featureFlagLogic'
import { objectsEqual } from 'lib/utils'
import { eventUsageLogic, InsightEventSource } from 'lib/utils/eventUsageLogic'
import { dashboardLogic } from 'scenes/dashboard/dashboardLogic'
import { insightSceneLogic } from 'scenes/insights/insightSceneLogic'
import { keyForInsightLogicProps } from 'scenes/insights/sharedUtils'
import { summarizeInsight } from 'scenes/insights/summarizeInsight'
Expand Down Expand Up @@ -417,7 +418,15 @@ export const insightLogic = kea<insightLogicType>([
},
})

dashboardsModel.actions.updateDashboardInsight(savedInsight)
// reload dashboards with updated insight
// since filters on dashboard might be different from filters on insight
// we need to trigger dashboard reload to pick up results for updated insight
savedInsight.dashboard_tiles?.forEach(({ dashboard_id }) =>
dashboardLogic.findMounted({ id: dashboard_id })?.actions.loadDashboard({
action: 'update',
refresh: 'lazy_async',
})
)

const mountedInsightSceneLogic = insightSceneLogic.findMounted()
if (redirectToViewMode) {
Expand Down

0 comments on commit 61d83fe

Please sign in to comment.