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(security): mount personalAPIKeysLogic so review screen renders (#60151)

Matt Brooker7d2188b14bc5
diff --git a/frontend/src/scenes/authentication/credential-review/credentialReviewLogic.ts b/frontend/src/scenes/authentication/credential-review/credentialReviewLogic.ts
index 21ec01180b35..dbbb8a047ed7 100644
--- a/frontend/src/scenes/authentication/credential-review/credentialReviewLogic.ts
+++ b/frontend/src/scenes/authentication/credential-review/credentialReviewLogic.ts
@@ -1,4 +1,4 @@
-import { actions, afterMount, kea, listeners, path } from 'kea'
+import { actions, afterMount, connect, kea, listeners, path } from 'kea'
import { router } from 'kea-router'
import api from 'lib/api'
@@ -11,6 +11,13 @@ import type { credentialReviewLogicType } from './credentialReviewLogicType'
export const credentialReviewLogic = kea<credentialReviewLogicType>([
path(['scenes', 'authentication', 'credentialReviewLogic']),
+ // connect (not a bare import call) so personalAPIKeysLogic is mounted as a dependency
+ // of this scene logic. afterMount runs before the review component renders, so without
+ // this the loadKeys() call below hits an unmounted logic and throws, which sceneLogic
+ // catches and turns into a 404 for the whole credential review screen.
+ connect(() => ({
+ actions: [personalAPIKeysLogic, ['loadKeys']],
+ })),
actions({
markComplete: true,
}),
@@ -30,10 +37,10 @@ export const credentialReviewLogic = kea<credentialReviewLogicType>([
router.actions.push(urls.projectHomepage())
},
}),
- afterMount(() => {
+ afterMount(({ actions }) => {
// personalAPIKeysLogic only auto-loads teams (not keys) when it mounts; the
// settings page calls loadKeys() from its own useEffect. Trigger it here so the
// review table isn't dismissable while empty.
- personalAPIKeysLogic.actions.loadKeys()
+ actions.loadKeys()
}),
])