-
-
Notifications
You must be signed in to change notification settings - Fork 4.2k
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
fix(replays): Fix 'clearQueryCache' method in 'useReplayData' hook #70539
Conversation
cd1ad07
to
fb801c8
Compare
queryKey: [`/organizations/${orgSlug}/replays-events-meta/`], | ||
}); | ||
}; | ||
queryClient.invalidateQueries({ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is only removing the extraneous () => {
on line 217
and the corresponding }
on line 231
.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks awesome, thanks for identifying that problem @floels and writing tests too!
@@ -32,10 +32,14 @@ jest.mocked(useProjects).mockReturnValue({ | |||
placeholders: [], | |||
}); | |||
|
|||
const mockInvalidateQueries = jest.fn(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Can we reset this before or after each test? This way if another test gets added the state from a previous test won't affect the new one.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah yes good point, added in the existing beforeEach
.
Fix a bug currently causing the 'clearQueryCache' method defined in 'static/app/utils/replays/hooks/useReplayData.tsx' to have no effect (extra arrow function declaration). Add a unit test to cover this behavior of the custom hook.
fb801c8
to
9944ba4
Compare
Goal
The goal of this PR is to fix a bug currently causing the
clearQueryCache
method defined instatic/app/utils/replays/hooks/useReplayData.tsx
to have no effect (extra arrow function declaration).Approach
Remove the duplicated arrow function declaration syntax (
() => { ... }
).We also add a unit test to cover this behavior of the custom hook. You can see that the test fails if you revert the fix in
useReplayData.tsx
.Legal Boilerplate
Look, I get it. The entity doing business as "Sentry" was incorporated in the State of Delaware in 2015 as Functional Software, Inc. and is gonna need some rights from me in order to utilize my contributions in this here PR. So here's the deal: I retain all rights, title and interest in and to my contributions, and by keeping this boilerplate intact I confirm that Sentry can use, modify, copy, and redistribute my contributions, under Sentry's choice of terms.