Repository navigation
ref(lint): add the eslint-plugin-query #86278
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
5d07f85
dcb1fb4
c78f47c
a8643f6
c48a08e
6c6e11b
822e763
ae81228
08138f3
ec0134f
9fd11b8
c0f0fad
fed57dd
5321680
e527699
20d7b92
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 |
|---|---|---|
|
|
@@ -53,7 +53,7 @@ export default function useMutateActivity({ | |
| onMutate, | ||
| onSettled, | ||
| }: Props) { | ||
| const mutation = useMutation<TData, TError, TVariables, TContext>({ | ||
| const {mutate} = useMutation<TData, TError, TVariables, TContext>({ | ||
| onMutate: onMutate ?? undefined, | ||
| mutationFn: ([{note, noteId}, method]) => { | ||
| const url = | ||
|
|
@@ -74,23 +74,23 @@ export default function useMutateActivity({ | |
|
|
||
| const handleUpdate = useCallback<UpdateCommentCallback>( | ||
| (note, noteId, activity, options) => { | ||
| mutation.mutate([{note, noteId, activity}, 'PUT'], options); | ||
| mutate([{note, noteId, activity}, 'PUT'], options); | ||
| }, | ||
| [mutation] | ||
| [mutate] | ||
|
Comment on lines
-77
to
+79
Collaborator
Author
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. top-level objects returned by Essentially, the memoization with |
||
| ); | ||
|
|
||
| const handleCreate = useCallback<CreateCommentCallback>( | ||
| (note, activity, options) => { | ||
| mutation.mutate([{note, activity}, 'POST'], options); | ||
| mutate([{note, activity}, 'POST'], options); | ||
| }, | ||
| [mutation] | ||
| [mutate] | ||
| ); | ||
|
|
||
| const handleDelete = useCallback<DeleteCommentCallback>( | ||
| (noteId, activity, options) => { | ||
| mutation.mutate([{noteId, activity}, 'DELETE'], options); | ||
| mutate([{noteId, activity}, 'DELETE'], options); | ||
| }, | ||
| [mutation] | ||
| [mutate] | ||
| ); | ||
|
|
||
| return { | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,28 +1,27 @@ | ||
| import {normalizeDateTimeParams} from 'sentry/components/organizations/pageFilters/parse'; | ||
| import type {UseQueryResult} from 'sentry/utils/queryClient'; | ||
| import {useQuery} from 'sentry/utils/queryClient'; | ||
| import {fetchDataQuery, useQuery, type UseQueryResult} from 'sentry/utils/queryClient'; | ||
| import type RequestError from 'sentry/utils/requestError/requestError'; | ||
| import useApi from 'sentry/utils/useApi'; | ||
| import useOrganization from 'sentry/utils/useOrganization'; | ||
| import usePageFilters from 'sentry/utils/usePageFilters'; | ||
|
|
||
| export function useHasProfilingChunks(): UseQueryResult<boolean, RequestError> { | ||
| const api = useApi(); | ||
| const organization = useOrganization(); | ||
| const {selection} = usePageFilters(); | ||
| const queryParams = { | ||
| query: { | ||
| project: selection.projects, | ||
| environment: selection.environments, | ||
| ...normalizeDateTimeParams(selection.datetime), | ||
| }, | ||
| }; | ||
|
|
||
| return useQuery({ | ||
| queryKey: [`/organizations/${organization.slug}/profiling/has-chunks/`], | ||
| queryFn: () => | ||
| api | ||
| .requestPromise(`/organizations/${organization.slug}/profiling/has-chunks/`, { | ||
| query: { | ||
| project: selection.projects, | ||
| environment: selection.environments, | ||
| ...normalizeDateTimeParams(selection.datetime), | ||
| }, | ||
| }) | ||
| .then((res: {hasChunks: boolean}) => res.hasChunks), | ||
| queryKey: [ | ||
| `/organizations/${organization.slug}/profiling/has-chunks/`, | ||
| queryParams, | ||
| ] as const, | ||
| queryFn: context => | ||
| fetchDataQuery<{hasChunks: boolean}>(context).then(res => res[0].hasChunks), | ||
| staleTime: 0, | ||
| }); | ||
| } |
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 defaults to
warning, but I think it’s important enough to up to error.