-
-
Notifications
You must be signed in to change notification settings - Fork 4.7k
fix(checkboxState): Update useListItemCheckboxContext to not rely on ApiQueryKey directly, only QueryKeyEndpointOptions #114997
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
be936ec
6ee5bb4
f96346a
71faf30
b296ada
cc365ed
f1251a2
bb5883e
782e427
fc53962
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -8,18 +8,15 @@ import {LoadingIndicator} from 'sentry/components/loadingIndicator'; | |
| import {IconCheckmark} from 'sentry/icons'; | ||
| import {t, tn} from 'sentry/locale'; | ||
| import {trackAnalytics} from 'sentry/utils/analytics'; | ||
| import type {ApiResponse} from 'sentry/utils/api/apiFetch'; | ||
| import type {ListCheckboxQueryKeyRef} from 'sentry/utils/list/useListItemCheckboxState'; | ||
| import {fetchMutation} from 'sentry/utils/queryClient'; | ||
| import {replayListApiOptions} from 'sentry/utils/replays/replayListApiOptions'; | ||
| import {useOrganization} from 'sentry/utils/useOrganization'; | ||
| import type { | ||
| HydratedReplayRecord, | ||
| ReplayListRecord, | ||
| } from 'sentry/views/explore/replays/types'; | ||
| import type {ReplayListRecord} from 'sentry/views/explore/replays/types'; | ||
|
|
||
| interface Props { | ||
| deselectAll: () => void; | ||
| queryKeyRef: ListCheckboxQueryKeyRef; | ||
| endpointOptionsRef: ListCheckboxQueryKeyRef; | ||
| replays: ReplayListRecord[]; | ||
| selectedIds: string[]; | ||
| } | ||
|
|
@@ -28,7 +25,7 @@ export function ReplayBulkViewedActions({ | |
| deselectAll, | ||
| replays, | ||
| selectedIds, | ||
| queryKeyRef, | ||
| endpointOptionsRef, | ||
| }: Props) { | ||
| const organization = useOrganization(); | ||
| const queryClient = useQueryClient(); | ||
|
|
@@ -55,10 +52,14 @@ export function ReplayBulkViewedActions({ | |
| ); | ||
|
|
||
| if (succeededIds.size) { | ||
| if (queryKeyRef.current) { | ||
| // eslint-disable-next-line @sentry/no-query-data-type-parameters | ||
| queryClient.setQueryData<ApiResponse<{data: HydratedReplayRecord[]}>>( | ||
| queryKeyRef.current, | ||
| if (endpointOptionsRef.current) { | ||
| const replayListOptions = replayListApiOptions({ | ||
| options: endpointOptionsRef.current, | ||
| organization, | ||
| queryReferrer: 'replayList', | ||
| }); | ||
| queryClient.setQueryData( | ||
| replayListOptions.queryKey, | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hardcoded queryReferrer causes fragile query key reconstructionMedium Severity The optimistic cache update reconstructs the full query key via Reviewed by Cursor Bugbot for commit fc53962. Configure here. |
||
| old => | ||
| old && { | ||
| ...old, | ||
|
|
||


Uh oh!
There was an error while loading. Please reload this page.