Skip to content

fix(seer): invalidate seer projects list after adding project via modal#117868

Merged
billyvg merged 1 commit into
masterfrom
fix/seer-projects-table-stale-after-add
Jun 16, 2026
Merged

fix(seer): invalidate seer projects list after adding project via modal#117868
billyvg merged 1 commit into
masterfrom
fix/seer-projects-table-stale-after-add

Conversation

@billyvg

@billyvg billyvg commented Jun 16, 2026

Copy link
Copy Markdown
Member

Problem

After adding a project to Autofix via the "Add Project" modal on /settings/seer/projects/, the table does not update to show the new project. It stays stale until the 60s staleTime expires or the page is refreshed.

Root cause

useMutateAutofixProject.onSettled invalidates several caches on success:

  • projectSeerPreferencesApiOptions (per-project legacy)
  • bulkAutofixAutomationSettingsInfiniteOptions (legacy /autofix/automation-settings/ endpoint)
  • getSeerProjectSettingsQueryOptions (per-project /projects/$org/$project/seer/settings/)
  • makeDetailedProjectQueryKey

But it does not invalidate getInfiniteSeerProjectsSettingsQueryOptions/organizations/$org/seer/projects/, which is the exact infinite query SeerProjectTable fetches from.

Inline table edits (getMutateSeerProjectSettingsOptions) already do this correctly. The modal mutation path (useMutateAutofixProject) was the gap.

Fix

Add the missing queryClient.invalidateQueries for the org-level seer projects infinite query in useMutateAutofixProject.onSettled, mirroring what getMutateSeerProjectSettingsOptions already does.


View Session in Sentry

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>
@github-actions github-actions Bot added the Scope: Frontend Automatically applied to PRs that change frontend components label Jun 16, 2026
@billyvg billyvg marked this pull request as ready for review June 16, 2026 22:09
@billyvg billyvg requested a review from a team as a code owner June 16, 2026 22:09
@billyvg billyvg merged commit 2be8165 into master Jun 16, 2026
72 checks passed
@billyvg billyvg deleted the fix/seer-projects-table-stale-after-add branch June 16, 2026 22:13
billyvg added a commit that referenced this pull request Jun 17, 2026
…al (#117868)

## Problem

After adding a project to Autofix via the "Add Project" modal on
`/settings/seer/projects/`, the table does not update to show the new
project. It stays stale until the 60s `staleTime` expires or the page is
refreshed.

## Root cause

`useMutateAutofixProject.onSettled` invalidates several caches on
success:
- `projectSeerPreferencesApiOptions` (per-project legacy)
- `bulkAutofixAutomationSettingsInfiniteOptions` (legacy
`/autofix/automation-settings/` endpoint)
- `getSeerProjectSettingsQueryOptions` (per-project
`/projects/$org/$project/seer/settings/`)
- `makeDetailedProjectQueryKey`

But it does **not** invalidate
`getInfiniteSeerProjectsSettingsQueryOptions` →
`/organizations/$org/seer/projects/`, which is the exact infinite query
`SeerProjectTable` fetches from.

Inline table edits (`getMutateSeerProjectSettingsOptions`) already do
this correctly. The modal mutation path (`useMutateAutofixProject`) was
the gap.

## Fix

Add the missing `queryClient.invalidateQueries` for the org-level seer
projects infinite query in `useMutateAutofixProject.onSettled`,
mirroring what `getMutateSeerProjectSettingsOptions` already does.

---
[View Session in
Sentry](https://sentry.sentry.io/traces/?project=4510944073809921&query=gen_ai.conversation.id%3A%22slack%3AC0AKG192UP3%3A1781646228.205609%22)

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
sehr-m pushed a commit that referenced this pull request Jun 23, 2026
…al (#117868)

## Problem

After adding a project to Autofix via the "Add Project" modal on
`/settings/seer/projects/`, the table does not update to show the new
project. It stays stale until the 60s `staleTime` expires or the page is
refreshed.

## Root cause

`useMutateAutofixProject.onSettled` invalidates several caches on
success:
- `projectSeerPreferencesApiOptions` (per-project legacy)
- `bulkAutofixAutomationSettingsInfiniteOptions` (legacy
`/autofix/automation-settings/` endpoint)
- `getSeerProjectSettingsQueryOptions` (per-project
`/projects/$org/$project/seer/settings/`)
- `makeDetailedProjectQueryKey`

But it does **not** invalidate
`getInfiniteSeerProjectsSettingsQueryOptions` →
`/organizations/$org/seer/projects/`, which is the exact infinite query
`SeerProjectTable` fetches from.

Inline table edits (`getMutateSeerProjectSettingsOptions`) already do
this correctly. The modal mutation path (`useMutateAutofixProject`) was
the gap.

## Fix

Add the missing `queryClient.invalidateQueries` for the org-level seer
projects infinite query in `useMutateAutofixProject.onSettled`,
mirroring what `getMutateSeerProjectSettingsOptions` already does.

---
[View Session in
Sentry](https://sentry.sentry.io/traces/?project=4510944073809921&query=gen_ai.conversation.id%3A%22slack%3AC0AKG192UP3%3A1781646228.205609%22)

Co-authored-by: sentry-junior[bot] <264270552+sentry-junior[bot]@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Scope: Frontend Automatically applied to PRs that change frontend components

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants