fix(issues): Prevent double fetch of group search view endpoint#112324
Merged
fix(issues): Prevent double fetch of group search view endpoint#112324
Conversation
IssueViewWrapper conditionally renders children behind a loading gate, so child observers mount after the parent's fetch completes. With staleTime: 0 the new observers immediately trigger a second fetch. Bumping to 30s prevents the redundant request while still refreshing on re-navigation. Mutations already update the cache directly so staleness doesn't matter for user-initiated changes. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
malwilley
approved these changes
Apr 7, 2026
| return useApiQuery<GroupSearchView>(makeFetchGroupSearchViewKey(parameters), { | ||
| staleTime: 0, | ||
| staleTime: 30_000, | ||
| retry: false, |
Contributor
There was a problem hiding this comment.
Bug: Setting staleTime: 30_000 in useFetchGroupSearchView can cause view data to be stale for up to 30 seconds in multi-user scenarios.
Severity: MEDIUM
Suggested Fix
Instead of setting a static staleTime, use the initialDataUpdatedAt option when providing initialData. This allows React Query to correctly assess the freshness of the initial data and trigger a background refetch when necessary, resolving the multi-user staleness without causing unnecessary fetches.
Prompt for AI Agent
Review the code at the location below. A potential bug has been identified by an AI
agent.
Verify if this is a real issue. If it is, propose a fix; if not, explain why it's not
valid.
Location: static/app/views/issueList/queries/useFetchGroupSearchView.tsx#L26
Potential issue: The introduction of a 30-second `staleTime` in the
`useFetchGroupSearchView` hook creates a data staleness issue in multi-user
environments. When the view is populated using `initialData` from the starred views
cache, this new `staleTime` prevents React Query from immediately refetching the data in
the background. Consequently, if one user modifies a shared view, another user currently
viewing it will not see the updates for up to 30 seconds. This happens because the data
is considered fresh for that duration, even though the underlying source may have
changed.
Did we get this right? 👍 / 👎 to inform future reviews.
george-sentry
pushed a commit
that referenced
this pull request
Apr 9, 2026
) `IssueViewWrapper` conditionally renders children behind a loading gate, so child observers mount after the parent's fetch completes. With `staleTime: 0` the new observers immediately trigger a second request to `/group-search-views/{id}/`. Bumping to 30s prevents the redundant request while still refreshing on re-navigation. Mutations already update the cache directly so staleness doesn't matter for user-initiated changes. Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
IssueViewWrapperconditionally renders children behind a loading gate, so child observers mount after the parent's fetch completes. WithstaleTime: 0the new observers immediately trigger a second request to/group-search-views/{id}/. Bumping to 30s prevents the redundant request while still refreshing on re-navigation. Mutations already update the cache directly so staleness doesn't matter for user-initiated changes.