From ec65d56becd5415a6b9df3916ca3d7b6bb3c82ca Mon Sep 17 00:00:00 2001 From: billy Date: Tue, 16 Jun 2026 21:51:38 +0000 Subject: [PATCH] fix(seer): invalidate seer projects list after adding project via modal useMutateAutofixProject.onSettled was invalidating per-project queries and the legacy automation-settings endpoint, but not the org-level /organizations/$org/seer/projects/ infinite query that SeerProjectTable renders from. As a result, the /settings/seer/projects/ table would not show a newly added project until its 60s staleTime expired or the page was refreshed. Inline table edits (getMutateSeerProjectSettingsOptions) already invalidate this query correctly; this mirrors that same pattern in the modal mutation path. Co-Authored-By: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com> --- static/app/utils/seer/useMutateAutofixProject.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/static/app/utils/seer/useMutateAutofixProject.ts b/static/app/utils/seer/useMutateAutofixProject.ts index ea83d07c552a89..acf7c73470e807 100644 --- a/static/app/utils/seer/useMutateAutofixProject.ts +++ b/static/app/utils/seer/useMutateAutofixProject.ts @@ -12,7 +12,10 @@ import { knownAgentIntegrationsQueryOptions, parseAgentOption, } from 'sentry/utils/seer/preferredAgent'; -import {getSeerProjectSettingsQueryOptions} from 'sentry/utils/seer/seerProjectSettings'; +import { + getInfiniteSeerProjectsSettingsQueryOptions, + getSeerProjectSettingsQueryOptions, +} from 'sentry/utils/seer/seerProjectSettings'; import { getTuningFromStoppingPoint, resolveStoppingPoint, @@ -163,6 +166,15 @@ export function useMutateAutofixProject() { projectSlug: project.slug, }), }); + // Invalidate the org-level infinite seer projects list so the + // /settings/seer/projects/ table reflects the newly added project + // without waiting for its 60s staleTime to expire. + const {queryKey: infiniteProjectsQueryKey} = + getInfiniteSeerProjectsSettingsQueryOptions({organization, query: {}}); + queryClient.invalidateQueries({ + queryKey: [infiniteProjectsQueryKey[0]], + exact: false, + }); }, }); }