fix(replays): correct query invalidation on refresh#115629
Conversation
📊 Type Coverage Diff
🔍 1 new type safety issue introducedNon-null assertions (
This is informational only and does not block the PR. |
|
|
||
| const queryClient = useQueryClient(); | ||
| const projectSlug = useReplayProjectSlug({replayRecord: replay}); | ||
| const projectSlug = useReplayProjectSlug({replayRecord: replay})!; |
There was a problem hiding this comment.
I don't like adding this !. But projectSlug is only used in places where it's defined...
TkDodo
left a comment
There was a problem hiding this comment.
I guess a test might be a good thing to add?
TkDodo
left a comment
There was a problem hiding this comment.
I thought one part of the problem was that we wouldn’t want to invalidate queries that are polling ? At least you had that in the previous solution. So wouldn’t we need to migrate this one to replayRecordApiOptions too:
sentry/static/app/utils/replays/hooks/usePollReplayRecord.tsx
Lines 20 to 28 in 0927cbc
and then make isPolling a required param to the function so that we only invalidate the ones were isPolling is false ?
| projectIdOrSlug: projectSlug!, | ||
| replayId: replayId!, |
There was a problem hiding this comment.
we could accept string | undefined here as input for those ids and then use skipToken internally to avoid the type assertion
There was a problem hiding this comment.
(talked 1:1) Existing code - I would love to refactor this, but since I'm just doing this as a spot fix for a virtual team, that'll have to be a followup. 😞
I'm somewhat low confidence I've understood the current/new query key plumbing correct. But I think this corrects the `doRefresh` callback to properly clear the replay & replay-segments data? Fixes REPLAY-910.
I'm somewhat low confidence I've understood the current/new query key plumbing correct. But I think this corrects the `doRefresh` callback to properly clear the replay & replay-segments data? Fixes REPLAY-910.
I'm somewhat low confidence I've understood the current/new query key plumbing correct. But I think this corrects the
doRefreshcallback to properly clear the replay & replay-segments data?Fixes REPLAY-910.