Skip to content

Commit

Permalink
fix: refresh user query on continue from org selection (#2975)
Browse files Browse the repository at this point in the history
  • Loading branch information
calvin-codecov authored Jul 2, 2024
1 parent bb4833d commit cf4e398
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,17 @@ describe('useUpdateDefaultOrganization', () => {
wrapper,
})
result.current.mutate({ username: 'codecov' })
const invalidateQueries = jest.spyOn(queryClient, 'invalidateQueries')

await waitFor(() => expect(result.current.isSuccess).toBeTruthy())

const username =
result.current.data.data.updateDefaultOrganization.username
await waitFor(() => expect(username).toBe('Gilmore'))

expect(invalidateQueries).toHaveBeenCalledTimes(2)
expect(invalidateQueries).toHaveBeenNthCalledWith(1, ['DetailOwner'])
expect(invalidateQueries).toHaveBeenNthCalledWith(2, ['currentUser'])
})
})
})
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export function useUpdateDefaultOrganization() {
)
} else {
queryClient.invalidateQueries(['DetailOwner'])
queryClient.invalidateQueries(['currentUser'])
}
},
onError: (e: any) => {
Expand Down

0 comments on commit cf4e398

Please sign in to comment.