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(visual-review): show not found for missing runs and repos without reporting (#129817)

Rafael Audibert26da9549c49a
diff --git a/products/visual_review/frontend/lib/repoIds.ts b/products/visual_review/frontend/lib/repoIds.ts
index 54f3cedfae8f..0d591576d9b5 100644
--- a/products/visual_review/frontend/lib/repoIds.ts
+++ b/products/visual_review/frontend/lib/repoIds.ts
@@ -10,6 +10,10 @@ export class RepoNotFoundError extends Error {
}
}
+export function isNotFoundError(error: unknown): boolean {
+ return error instanceof RepoNotFoundError || (error as { status?: number } | null)?.status === 404
+}
+
// GitHub treats owner and repo names as case-insensitive, so a link typed by hand still resolves.
// A repo that was deleted and connected again has two rows with the same name, and the newest one is live.
export function findRepoByFullName(repos: RepoApi[], repoFullName: string): RepoApi | null {
@@ -92,6 +96,19 @@ export async function resolveRepoId(projectId: string, repoFullName: string): Pr
return repo.id
}
+// For loaders that run beside visualReviewRepoLogic: that logic shows NotFound for a missing repo,
+// so these loaders return their empty value instead of failing a second time.
+export async function resolveRepoIdOrNull(projectId: string, repoFullName: string): Promise<string | null> {
+ try {
+ return await resolveRepoId(projectId, repoFullName)
+ } catch (error) {
+ if (error instanceof RepoNotFoundError) {
+ return null
+ }
+ throw error
+ }
+}
+
export async function resolveRepoFullName(projectId: string, repoId: string): Promise<string> {
const repo = await findRepo(projectId, (repos) => repos.find((candidate) => candidate.id === repoId) ?? null)
if (!repo) {
diff --git a/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx b/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
index 5bf893488eff..74781ee7884c 100644
--- a/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
+++ b/products/visual_review/frontend/scenes/VisualReviewRunScene.tsx
@@ -7,6 +7,7 @@ import { LemonButton, LemonCheckbox, LemonSkeleton, Link } from '@posthog/lemon-
import { PostHogCaptureOnViewed } from '@posthog/react'
import { pngHoggie } from 'lib/brand/hoggies'
+import { NotFound } from 'lib/components/NotFound'
import { useFeatureFlag } from 'lib/hooks/useFeatureFlag'
import { useKeyboardHotkeys } from 'lib/hooks/useKeyboardHotkeys'
import { KeyboardShortcut } from 'lib/lemon-ui/KeyboardShortcut/KeyboardShortcut'
@@ -287,6 +288,7 @@ export function VisualReviewRunScene(): JSX.Element {
failedThumbnails,
thumbnailBasePath,
addImagesToComment,
+ runNotFound,
} = useValues(visualReviewRunSceneLogic)
const {
setSelectedSnapshotId,
@@ -353,6 +355,10 @@ export function VisualReviewRunScene(): JSX.Element {
// Show skeleton only on initial load — once `run` is populated, keep showing it
// even while a background refetch is in flight (e.g. after approve/tolerate),
// otherwise the whole scene flashes to skeleton on every mutation.
+ if (runNotFound) {
+ return <NotFound object="visual review run" />
+ }
+
if (!run) {
return (
<SceneContent>
diff --git a/products/visual_review/frontend/scenes/visualReviewFlakinessSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewFlakinessSceneLogic.ts
index 7ef055025383..c460bbf9ef1f 100644
--- a/products/visual_review/frontend/scenes/visualReviewFlakinessSceneLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewFlakinessSceneLogic.ts
@@ -18,7 +18,7 @@ import {
import type { FlakinessEntryApi, FlakinessOverviewApi, RepoApi } from '../generated/api.schemas'
import { parseArea, runTypeLabel } from '../lib/parseIdentifier'
import { repoBreadcrumbs } from '../lib/repoBreadcrumbs'
-import { resolveRepoId } from '../lib/repoIds'
+import { resolveRepoId, resolveRepoIdOrNull } from '../lib/repoIds'
import { repoFullNameFromParams, splitRepoFullName } from '../lib/repoPaths'
import { visualReviewRepoLogic } from './visualReviewRepoLogic'
@@ -234,10 +234,10 @@ export interface visualReviewFlakinessSceneLogicActions {
errorObject?: any
}
loadOverviewSuccess: (
- overview: FlakinessOverviewApi,
+ overview: FlakinessOverviewApi | null,
payload?: any
) => {
- overview: FlakinessOverviewApi
+ overview: FlakinessOverviewApi | null
payload?: any
}
quarantineIdentifier: (
@@ -420,7 +420,10 @@ export const visualReviewFlakinessSceneLogic = kea<visualReviewFlakinessSceneLog
{
loadOverview: async () => {
const projectId = String(values.currentProjectId)
- const repoId = await resolveRepoId(projectId, props.repoFullName)
+ const repoId = await resolveRepoIdOrNull(projectId, props.repoFullName)
+ if (!repoId) {
+ return null
+ }
return visualReviewReposFlakinessRetrieve(projectId, repoId)
},
},
diff --git a/products/visual_review/frontend/scenes/visualReviewIndexSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewIndexSceneLogic.ts
index 6943f6512503..d048db1b86fa 100644
--- a/products/visual_review/frontend/scenes/visualReviewIndexSceneLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewIndexSceneLogic.ts
@@ -8,7 +8,7 @@ import { Breadcrumb } from '~/types'
import { visualReviewReposList, visualReviewRunsRetrieve } from '../generated/api'
import { ForwardUrl, LegacyRoute, legacyForwardUrl, pickLandingRepo } from '../lib/forwardUrls'
-import { RepoNotFoundError, resolveRepoFullName } from '../lib/repoIds'
+import { isNotFoundError, resolveRepoFullName } from '../lib/repoIds'
import { splitRepoFullName } from '../lib/repoPaths'
import { visualReviewPreferencesLogic } from './visualReviewPreferencesLogic'
@@ -40,10 +40,6 @@ export type visualReviewIndexSceneLogicType = MakeLogicType<
visualReviewIndexSceneLogicActions
>
-function isNotFound(error: any): boolean {
- return error instanceof RepoNotFoundError || error?.status === 404
-}
-
// Forwarding scene logic. `/visual-review` goes to the repo the team used last, else the first
// connected repo, else Settings. URLs that name a repo or a run by UUID go to the owner/name URL
// of the same page. A failed or unresolvable lookup stays here to show its state, so it cannot loop.
@@ -105,7 +101,7 @@ export const visualReviewIndexSceneLogic = kea<visualReviewIndexSceneLogicType>(
}
} catch (error) {
if (router.values.location.pathname === pathname) {
- actions.forwardFailed(isNotFound(error) ? 'not_found' : 'load_failed')
+ actions.forwardFailed(isNotFoundError(error) ? 'not_found' : 'load_failed')
}
return
}
diff --git a/products/visual_review/frontend/scenes/visualReviewRepoLogic.test.ts b/products/visual_review/frontend/scenes/visualReviewRepoLogic.test.ts
new file mode 100644
index 000000000000..5687ecac110f
--- /dev/null
+++ b/products/visual_review/frontend/scenes/visualReviewRepoLogic.test.ts
@@ -0,0 +1,36 @@
+import { expectLogic } from 'kea-test-utils'
+import posthog from 'posthog-js'
+
+import { useMocks } from '~/mocks/jest'
+import { initKeaTests } from '~/test/init'
+
+import { clearRepoIdCache } from '../lib/repoIds'
+import { visualReviewRepoLogic } from './visualReviewRepoLogic'
+
+describe('visualReviewRepoLogic', () => {
+ beforeEach(() => {
+ useMocks({
+ get: {
+ '/api/projects/:team_id/visual_review/repos/': [
+ 200,
+ { count: 0, next: null, previous: null, results: [] },
+ ],
+ },
+ })
+ initKeaTests()
+ clearRepoIdCache()
+ })
+
+ it('marks a repo missing from the project as not found without reporting it', async () => {
+ const captureException = jest.spyOn(posthog, 'captureException')
+ const logic = visualReviewRepoLogic({ repoFullName: 'example/missing' })
+ logic.mount()
+
+ await expectLogic(logic)
+ .toDispatchActions(['setRepoNotFound', 'loadRepoSuccess'])
+ .toMatchValues({ repoNotFound: true, repo: null })
+ expect(captureException).not.toHaveBeenCalled()
+
+ logic.unmount()
+ })
+})
diff --git a/products/visual_review/frontend/scenes/visualReviewRepoLogic.ts b/products/visual_review/frontend/scenes/visualReviewRepoLogic.ts
index 507d9bfdaec5..7040c326136b 100644
--- a/products/visual_review/frontend/scenes/visualReviewRepoLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewRepoLogic.ts
@@ -1,11 +1,11 @@
-import { MakeLogicType, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
+import { MakeLogicType, actions, afterMount, connect, kea, key, listeners, path, props, reducers, selectors } from 'kea'
import { loaders } from 'kea-loaders'
import { teamLogic } from 'scenes/teamLogic'
import { visualReviewReposList, visualReviewReposRetrieve } from '../generated/api'
import type { RepoApi } from '../generated/api.schemas'
-import { RepoNotFoundError, resolveRepoId } from '../lib/repoIds'
+import { isNotFoundError, resolveRepoId } from '../lib/repoIds'
import { visualReviewPreferencesLogic } from './visualReviewPreferencesLogic'
export interface VisualReviewRepoLogicProps {
@@ -56,12 +56,15 @@ export interface visualReviewRepoLogicActions {
errorObject?: any
}
loadRepoSuccess: (
- repo: RepoApi,
+ repo: RepoApi | null,
payload?: any
) => {
- repo: RepoApi
+ repo: RepoApi | null
payload?: any
}
+ setRepoNotFound: () => {
+ value: true
+ }
}
// Generated by kea-typegen. Update if you're an agent, ignore if you're human.
@@ -91,13 +94,27 @@ export const visualReviewRepoLogic = kea<visualReviewRepoLogicType>([
values: [teamLogic, ['currentProjectId']],
actions: [visualReviewPreferencesLogic, ['rememberRepo']],
})),
- loaders(({ props, values }) => ({
+ actions({
+ setRepoNotFound: true,
+ }),
+ loaders(({ actions, props, values }) => ({
repo: [
null as RepoApi | null,
{
loadRepo: async () => {
const projectId = String(values.currentProjectId)
- return visualReviewReposRetrieve(projectId, await resolveRepoId(projectId, props.repoFullName))
+ try {
+ return await visualReviewReposRetrieve(
+ projectId,
+ await resolveRepoId(projectId, props.repoFullName)
+ )
+ } catch (error) {
+ if (isNotFoundError(error)) {
+ actions.setRepoNotFound()
+ return null
+ }
+ throw error
+ }
},
},
],
@@ -119,7 +136,7 @@ export const visualReviewRepoLogic = kea<visualReviewRepoLogicType>([
false,
{
loadRepo: () => false,
- loadRepoFailure: (_, { errorObject }) => errorObject instanceof RepoNotFoundError,
+ setRepoNotFound: () => true,
},
],
}),
@@ -132,7 +149,9 @@ export const visualReviewRepoLogic = kea<visualReviewRepoLogicType>([
}),
listeners(({ actions }) => ({
loadRepoSuccess: ({ repo }) => {
- actions.rememberRepo(repo.team_id, repo.repo_full_name)
+ if (repo) {
+ actions.rememberRepo(repo.team_id, repo.repo_full_name)
+ }
},
})),
afterMount(({ actions }) => {
diff --git a/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.test.ts b/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.test.ts
index 61107af790aa..153fd01ddc8c 100644
--- a/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.test.ts
+++ b/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.test.ts
@@ -1,5 +1,8 @@
import { router } from 'kea-router'
import { expectLogic, partial } from 'kea-test-utils'
+import posthog from 'posthog-js'
+
+import { lemonToast } from 'lib/lemon-ui/LemonToast/LemonToast'
import { useMocks } from '~/mocks/jest'
import { initKeaTests } from '~/test/init'
@@ -59,6 +62,22 @@ describe('visualReviewRunSceneLogic', () => {
logic.unmount()
})
+ it('shows not found for a missing run without a toast or an error report', async () => {
+ logic.unmount()
+ const captureException = jest.spyOn(posthog, 'captureException')
+ const toastError = jest.spyOn(lemonToast, 'error')
+ logic = visualReviewRunSceneLogic({ runId: RUN_ID })
+ logic.mount()
+ // PR comment links carry a snapshot, which makes a successful snapshots load fetch it again.
+ logic.actions.setSelectedSnapshotId(UNCHANGED_SNAPSHOT.id)
+
+ await expectLogic(logic)
+ .toDispatchActions(['setRunNotFound', 'loadRunSuccess', 'loadDeepLinkedSnapshotSuccess'])
+ .toMatchValues({ runNotFound: true, run: null })
+ expect(captureException).not.toHaveBeenCalled()
+ expect(toastError).not.toHaveBeenCalled()
+ })
+
it('drops the previous snapshot tolerations when the next load fails', async () => {
await expectLogic(logic, () => logic.actions.loadToleratedHashes('flaky'))
.toDispatchActions(['loadToleratedHashesSuccess'])
diff --git a/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts
index b8148f786778..b89d490dd485 100644
--- a/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewRunSceneLogic.ts
@@ -41,6 +41,7 @@ import {
} from '../lib/liftOnMerge'
import { type RecentTolerations, countRecentTolerations } from '../lib/quarantineNudge'
import { repoBreadcrumbs } from '../lib/repoBreadcrumbs'
+import { isNotFoundError } from '../lib/repoIds'
import { runPath } from '../lib/repoPaths'
import { isReportingOnlyRun } from '../lib/runPredicates'
import { visualReviewPreferencesLogic } from './visualReviewPreferencesLogic'
@@ -88,6 +89,7 @@ export interface visualReviewRunSceneLogicValues {
repoLoading: boolean
run: RunApi | null
runLoading: boolean
+ runNotFound: boolean
selectedLiftOnMergeDisabledReason: string | null
selectedLiftRequest: QuarantineLiftEntryApi | null
selectedSnapshot: SnapshotApi | null
@@ -227,10 +229,10 @@ export interface visualReviewRunSceneLogicActions {
errorObject?: any
}
loadRunSuccess: (
- run: RunApi,
+ run: RunApi | null,
payload?: any
) => {
- run: RunApi
+ run: RunApi | null
payload?: any
}
loadSnapshots: () => any
@@ -300,6 +302,9 @@ export interface visualReviewRunSceneLogicActions {
requestLiftOnMergeSuccess: () => {
value: true
}
+ setRunNotFound: () => {
+ value: true
+ }
setSelectedSnapshotId: (snapshotId: string | null) => {
snapshotId: string | null
}
@@ -392,6 +397,7 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
actions: [visualReviewPreferencesLogic, ['setAddImagesToComment', 'rememberRepo']],
})),
actions({
+ setRunNotFound: true,
setSelectedSnapshotId: (snapshotId: string | null) => ({ snapshotId }),
finalizeRun: true,
finalizeRunSuccess: true,
@@ -443,6 +449,13 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
setSelectedSnapshotId: (_, { snapshotId }) => snapshotId,
},
],
+ runNotFound: [
+ false,
+ {
+ setRunNotFound: () => true,
+ loadRunSuccess: (state, { run }) => (run ? false : state),
+ },
+ ],
snapshotsLoaded: [
false,
{
@@ -540,12 +553,20 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
},
],
}),
- loaders(({ props, values }) => ({
+ loaders(({ actions, props, values }) => ({
run: [
null as RunApi | null,
{
loadRun: async () => {
- return visualReviewRunsRetrieve(String(values.currentProjectId), props.runId)
+ try {
+ return await visualReviewRunsRetrieve(String(values.currentProjectId), props.runId)
+ } catch (error) {
+ if (isNotFoundError(error)) {
+ actions.setRunNotFound()
+ return null
+ }
+ throw error
+ }
},
},
],
@@ -553,12 +574,24 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
[] as SnapshotApi[],
{
loadSnapshots: async () => {
- const response = await visualReviewRunsSnapshotsList(String(values.currentProjectId), props.runId, {
- limit: 10000,
- include_quarantined: true,
- exclude_unchanged: true,
- })
- return response.results
+ try {
+ const response = await visualReviewRunsSnapshotsList(
+ String(values.currentProjectId),
+ props.runId,
+ {
+ limit: 10000,
+ include_quarantined: true,
+ exclude_unchanged: true,
+ }
+ )
+ return response.results
+ } catch (error) {
+ // The run itself is missing, and loadRun renders NotFound for it.
+ if (isNotFoundError(error)) {
+ return []
+ }
+ throw error
+ }
},
},
],
@@ -568,10 +601,18 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
null as SnapshotApi | null,
{
loadDeepLinkedSnapshot: async (snapshotId: string, breakpoint) => {
- const response = await visualReviewRunsSnapshotsList(String(values.currentProjectId), props.runId, {
- include_quarantined: true,
- snapshot_id: snapshotId,
- })
+ let response
+ try {
+ response = await visualReviewRunsSnapshotsList(String(values.currentProjectId), props.runId, {
+ include_quarantined: true,
+ snapshot_id: snapshotId,
+ })
+ } catch (error) {
+ if (isNotFoundError(error)) {
+ return null
+ }
+ throw error
+ }
breakpoint()
// The user may have gone back to a snapshot cached here, which starts no request.
if (values.selectedSnapshotId !== snapshotId) {
@@ -867,7 +908,10 @@ export const visualReviewRunSceneLogic = kea<visualReviewRunSceneLogicType>([
actions.loadToleratedHashes(snapshot.identifier)
}
},
- loadRunSuccess: () => {
+ loadRunSuccess: ({ run }) => {
+ if (!run) {
+ return
+ }
actions.loadRepo()
actions.loadQuarantinedIdentifiers()
actions.loadQuarantineLifts()
diff --git a/products/visual_review/frontend/scenes/visualReviewRunsSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewRunsSceneLogic.ts
index 16392d4aed35..9512a2e0bbd8 100644
--- a/products/visual_review/frontend/scenes/visualReviewRunsSceneLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewRunsSceneLogic.ts
@@ -13,7 +13,7 @@ import type {
VisualReviewReposRunsListReviewState,
} from '../generated/api.schemas'
import { repoBreadcrumbs } from '../lib/repoBreadcrumbs'
-import { resolveRepoId } from '../lib/repoIds'
+import { resolveRepoIdOrNull } from '../lib/repoIds'
import { visualReviewRepoLogic } from './visualReviewRepoLogic'
export type ReviewState = VisualReviewReposRunsListReviewState
@@ -159,7 +159,10 @@ export const visualReviewRunsSceneLogic = kea<visualReviewRunsSceneLogicType>([
// Tag each request; a slower, superseded one must not overwrite a newer one's results.
const requestId = (cache.loadRunsSeq = (cache.loadRunsSeq ?? 0) + 1)
const projectId = String(values.currentProjectId)
- const repoId = await resolveRepoId(projectId, props.repoFullName)
+ const repoId = await resolveRepoIdOrNull(projectId, props.repoFullName)
+ if (!repoId) {
+ return values.runsResponse
+ }
const response = await visualReviewReposRunsList(projectId, repoId, {
review_state: values.activeTab,
limit: RUNS_PAGE_SIZE,
@@ -178,7 +181,10 @@ export const visualReviewRunsSceneLogic = kea<visualReviewRunsSceneLogicType>([
{
loadCounts: async () => {
const projectId = String(values.currentProjectId)
- const repoId = await resolveRepoId(projectId, props.repoFullName)
+ const repoId = await resolveRepoIdOrNull(projectId, props.repoFullName)
+ if (!repoId) {
+ return values.counts
+ }
return await visualReviewReposRunsCountsRetrieve(projectId, repoId)
},
},
diff --git a/products/visual_review/frontend/scenes/visualReviewSnapshotHistorySceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewSnapshotHistorySceneLogic.ts
index 16e766979240..bf5c0c750d65 100644
--- a/products/visual_review/frontend/scenes/visualReviewSnapshotHistorySceneLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewSnapshotHistorySceneLogic.ts
@@ -14,7 +14,7 @@ import {
} from '../generated/api'
import type { QuarantinedIdentifierEntryApi, RepoApi, SnapshotHistoryEntryApi } from '../generated/api.schemas'
import { repoBreadcrumbs } from '../lib/repoBreadcrumbs'
-import { resolveRepoId } from '../lib/repoIds'
+import { resolveRepoId, resolveRepoIdOrNull } from '../lib/repoIds'
import { visualReviewRepoLogic } from './visualReviewRepoLogic'
export interface VisualReviewSnapshotHistorySceneLogicProps {
@@ -210,7 +210,10 @@ export const visualReviewSnapshotHistorySceneLogic = kea<visualReviewSnapshotHis
{
loadHistory: async () => {
const projectId = String(values.currentProjectId)
- const repoId = await resolveRepoId(projectId, props.repoFullName)
+ const repoId = await resolveRepoIdOrNull(projectId, props.repoFullName)
+ if (!repoId) {
+ return []
+ }
const response = await visualReviewReposSnapshotsList(
projectId,
repoId,
@@ -232,7 +235,10 @@ export const visualReviewSnapshotHistorySceneLogic = kea<visualReviewSnapshotHis
}
const partner = `${stem}--${theme === 'light' ? 'dark' : 'light'}`
const projectId = String(values.currentProjectId)
- const repoId = await resolveRepoId(projectId, props.repoFullName)
+ const repoId = await resolveRepoIdOrNull(projectId, props.repoFullName)
+ if (!repoId) {
+ return []
+ }
const response = await visualReviewReposSnapshotsList(
projectId,
repoId,
@@ -249,7 +255,10 @@ export const visualReviewSnapshotHistorySceneLogic = kea<visualReviewSnapshotHis
{
loadQuarantineEntry: async () => {
const projectId = String(values.currentProjectId)
- const repoId = await resolveRepoId(projectId, props.repoFullName)
+ const repoId = await resolveRepoIdOrNull(projectId, props.repoFullName)
+ if (!repoId) {
+ return null
+ }
const response = await visualReviewReposQuarantineList(projectId, repoId, {
identifier: props.identifier,
run_type: props.runType,
@@ -277,7 +286,10 @@ export const visualReviewSnapshotHistorySceneLogic = kea<visualReviewSnapshotHis
return null
}
const projectId = String(values.currentProjectId)
- const repoId = await resolveRepoId(projectId, props.repoFullName)
+ const repoId = await resolveRepoIdOrNull(projectId, props.repoFullName)
+ if (!repoId) {
+ return null
+ }
const response = await visualReviewReposQuarantineList(projectId, repoId, {
identifier: sibling,
run_type: props.runType,
diff --git a/products/visual_review/frontend/scenes/visualReviewSnapshotOverviewSceneLogic.ts b/products/visual_review/frontend/scenes/visualReviewSnapshotOverviewSceneLogic.ts
index 393e42112fe5..9d2c4734d1ed 100644
--- a/products/visual_review/frontend/scenes/visualReviewSnapshotOverviewSceneLogic.ts
+++ b/products/visual_review/frontend/scenes/visualReviewSnapshotOverviewSceneLogic.ts
@@ -14,7 +14,7 @@ import type { BaselineEntryApi, BaselineOverviewApi } from '../generated/api.sch
import type { RepoApi } from '../generated/api.schemas'
import { parseArea, parseTheme, runTypeLabel } from '../lib/parseIdentifier'
import { repoBreadcrumbs } from '../lib/repoBreadcrumbs'
-import { resolveRepoId } from '../lib/repoIds'
+import { resolveRepoIdOrNull } from '../lib/repoIds'
import { repoFullNameFromParams, splitRepoFullName } from '../lib/repoPaths'
import { visualReviewRepoLogic } from './visualReviewRepoLogic'
@@ -202,10 +202,10 @@ export interface visualReviewSnapshotOverviewSceneLogicActions {
errorObject?: any
}
loadOverviewSuccess: (
- overview: BaselineOverviewApi,
+ overview: BaselineOverviewApi | null,
payload?: any
) => {
- overview: BaselineOverviewApi
+ overview: BaselineOverviewApi | null
payload?: any
}
setOverviewRepoId: (repoId: string) => {
@@ -357,7 +357,10 @@ export const visualReviewSnapshotOverviewSceneLogic = kea<visualReviewSnapshotOv
{
loadOverview: async () => {
const projectId = String(values.currentProjectId)
- const repoId = await resolveRepoId(projectId, props.repoFullName)
+ const repoId = await resolveRepoIdOrNull(projectId, props.repoFullName)
+ if (!repoId) {
+ return null
+ }
actions.setOverviewRepoId(repoId)
return visualReviewReposBaselinesRetrieve(projectId, repoId)
},