Skip to content

:hedgehog: PostHog is the leading platform for building self-driving products. Our developer tools – AI observability, analytics, session replay, flags, experiments, error tracking, logs, and more – capture all the context agents need to diagnose problems, uncover opportunities, and ship fixes. Steer it all from Slack, web, desktop, or the MCP.

fix(data-warehouse): reflect updated materialization sync frequency (#65198)

Jovan Sakovic1aa49abdcdd0
diff --git a/frontend/src/scenes/data-warehouse/saved_queries/dataWarehouseViewsLogic.tsx b/frontend/src/scenes/data-warehouse/saved_queries/dataWarehouseViewsLogic.tsx
index 29b360cbb694..18fe2f7af1a7 100644
--- a/frontend/src/scenes/data-warehouse/saved_queries/dataWarehouseViewsLogic.tsx
+++ b/frontend/src/scenes/data-warehouse/saved_queries/dataWarehouseViewsLogic.tsx
@@ -136,6 +136,9 @@ export const dataWarehouseViewsLogic = kea<dataWarehouseViewsLogicType>([
posthog.capture(`materialized view ${payload.lifecycle === 'update' ? 'updated' : 'created'}`, {
sync_frequency: payload.sync_frequency,
})
+ if (payload.lifecycle === 'update') {
+ lemonToast.success('Sync frequency updated')
+ }
}
if (payload?.shouldRematerialize) {
diff --git a/frontend/src/scenes/data-warehouse/saved_queries/materializationJobsLogic.ts b/frontend/src/scenes/data-warehouse/saved_queries/materializationJobsLogic.ts
index 86b2ffc191c0..4e3f39f2e323 100644
--- a/frontend/src/scenes/data-warehouse/saved_queries/materializationJobsLogic.ts
+++ b/frontend/src/scenes/data-warehouse/saved_queries/materializationJobsLogic.ts
@@ -1,10 +1,11 @@
-import { actions, afterMount, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
+import { actions, afterMount, connect, kea, key, listeners, path, props, propsChanged, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import api, { PaginatedResponse } from 'lib/api'
import { DataModelingJob, DataWarehouseSavedQuery } from '~/types'
+import { dataWarehouseViewsLogic } from './dataWarehouseViewsLogic'
import type { materializationJobsLogicType } from './materializationJobsLogicType'
const REFRESH_INTERVAL = 10000
@@ -18,6 +19,9 @@ export const materializationJobsLogic = kea<materializationJobsLogicType>([
path(['scenes', 'data-warehouse', 'saved_queries', 'materializationJobsLogic']),
props({} as MaterializationJobsLogicProps),
key((props) => props.viewId),
+ connect(() => ({
+ actions: [dataWarehouseViewsLogic, ['updateDataWarehouseSavedQuerySuccess']],
+ })),
actions({
setStartingMaterialization: (starting: boolean) => ({ starting }),
}),
@@ -96,7 +100,15 @@ export const materializationJobsLogic = kea<materializationJobsLogicType>([
actions.loadSavedQuery()
}
}),
- listeners(({ actions, cache }) => ({
+ listeners(({ actions, cache, props }) => ({
+ updateDataWarehouseSavedQuerySuccess: ({ payload }) => {
+ // The sync frequency dropdown mutates this saved query through dataWarehouseViewsLogic, which
+ // doesn't own our `savedQuery`. Reload it so the displayed frequency reflects the new value
+ // immediately instead of reverting until the next poll.
+ if (payload?.id === props.viewId) {
+ actions.loadSavedQuery()
+ }
+ },
loadDataModelingJobsSuccess: () => {
// Refresh saved query alongside jobs so latest_error / status / sync_frequency stay in sync.
actions.loadSavedQuery()