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(replay-vision): reload bulk-scan scanners on team change (#62538)

Kim Svatos Dugan67eacaf69dd4
diff --git a/products/replay_vision/frontend/logics/bulkScanLogic.ts b/products/replay_vision/frontend/logics/bulkScanLogic.ts
index b85d74d89373..238487b3ef43 100644
--- a/products/replay_vision/frontend/logics/bulkScanLogic.ts
+++ b/products/replay_vision/frontend/logics/bulkScanLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, kea, listeners, path, reducers } from 'kea'
+import { actions, afterMount, connect, kea, listeners, path, reducers } from 'kea'
import { loaders } from 'kea-loaders'
import { router } from 'kea-router'
@@ -13,6 +13,10 @@ import type { bulkScanLogicType } from './bulkScanLogicType'
export const bulkScanLogic = kea<bulkScanLogicType>([
path(['products', 'replay_vision', 'frontend', 'logics', 'bulkScanLogic']),
+ connect(() => ({
+ actions: [teamLogic, ['loadCurrentTeamSuccess']],
+ })),
+
actions({
scanRecordings: (scannerId: string, sessionIds: string[]) => ({ scannerId, sessionIds }),
scanRecordingsSuccess: true,
@@ -53,7 +57,12 @@ export const bulkScanLogic = kea<bulkScanLogicType>([
listeners(({ actions, values }) => ({
scanRecordings: async ({ scannerId, sessionIds }) => {
const teamId = teamLogic.values.currentTeamId
- if (!teamId || sessionIds.length === 0) {
+ if (sessionIds.length === 0) {
+ lemonToast.error('Select at least one recording to scan')
+ actions.scanRecordingsFailure()
+ return
+ }
+ if (!teamId) {
actions.scanRecordingsFailure()
return
}
@@ -83,6 +92,11 @@ export const bulkScanLogic = kea<bulkScanLogicType>([
}
actions.scanRecordingsSuccess()
},
+ // The logic is global/propless, so reload scanners when the active team changes
+ // to avoid POSTing the previous team's scanner IDs to the new team's endpoint.
+ loadCurrentTeamSuccess: () => {
+ actions.loadScanners()
+ },
})),
afterMount(({ actions }) => {