-
Notifications
You must be signed in to change notification settings - Fork 7
feat: add @tanstack/react-query package, custom QueryClientProvider, useQueryClient hook #747
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
Merged
Merged
Changes from all commits
Commits
Show all changes
37 commits
Select commit
Hold shift + click to select a range
8b00919
feat: add @tanstack/react-query package, custom QueryClientProvider, …
RohitRaj011 a138770
chore(version): bump to 1.14.0-beta-0
RohitRaj011 f9e42a1
feat: update react-query type definitions
RohitRaj011 fdc59c2
feat: update error handling flags in QueryClientProvider and default …
RohitRaj011 4cba97c
chore(version): bump to 1.14.0-beta-1
RohitRaj011 b5d97bc
chore: revert @types/react-dates to dependencies
RohitRaj011 89de0f2
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
RohitRaj011 91f3ab3
fix: move @types/react-dates to dev dependency
RohitRaj011 6c4a25f
chore(version): bump to 1.14.2-beta-0
RohitRaj011 861fe1a
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
RohitRaj011 8668f37
chore(version): bump to 1.17.0-beta-5
RohitRaj011 91f53d9
chore: add @tanstack/eslint-plugin-query to ESLint configuration and …
RohitRaj011 d9c5099
chore: rename useQueryClient -> reactQueryHooks
RohitRaj011 af2deef
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
RohitRaj011 ba91195
chore(version): bump to 1.17.0-pre-11
RohitRaj011 c4f0637
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
RohitRaj011 b7aa854
feat(CoreAPI): add mergeAbortSignals method for handling multiple Abo…
RohitRaj011 2a779db
fix(QueryClientProvider): remove contextSharing prop from RQQueryClie…
RohitRaj011 1cfa5c1
Merge branch 'develop' of github.com:devtron-labs/devtron-fe-common-l…
RohitRaj011 6a151ef
chore(version): bump to 1.17.0-pre-16
RohitRaj011 30ca3ec
feat: enhance mergeAbortSignals to include cleanup for event listeners
RohitRaj011 b1254c9
refactor: CoreAPI - update mergeAbortSignals
RohitRaj011 81998ce
chore(version): bump to 1.18.0
RohitRaj011 d16dee3
Merge pull request #825 from devtron-labs/rc-merge/v0.40.0
RohitRaj011 bf45e48
chore: error layout fix
shivani170 322af73
chore: util revert
shivani170 93f9b58
chore: navlink import
shivani170 1fb2683
chore: css fixes
shivani170 2ec77a7
chore: css fixes
shivani170 f3ee1f2
chore: Navlink added to header
shivani170 fb8646e
chore: css fixes
shivani170 3a8146b
chore: css fixes
shivani170 67284b6
chore: text replaced with Check Permission
shivani170 4f49b53
Merge pull request #829 from devtron-labs/fix/image-pull-message
shivani170 4064c82
Merge pull request #826 from devtron-labs/release-candidate-v0.40.0
RohitRaj011 85759b3
Merge branch 'main' of github.com:devtron-labs/devtron-fe-common-lib …
RohitRaj011 19bb9c0
chore(version): bump to 1.18.0-pre-0
RohitRaj011 File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,44 @@ | ||
| import { PropsWithChildren } from 'react' | ||
| import { | ||
| MutationCache, | ||
| QueryCache, | ||
| QueryClient, | ||
| QueryClientProvider as RQQueryClientProvider, | ||
| } from '@tanstack/react-query' | ||
|
|
||
| import { showError } from '@Common/Helper' | ||
|
|
||
| const queryClient = new QueryClient({ | ||
| defaultOptions: { | ||
| queries: { | ||
| cacheTime: 0, | ||
| refetchOnWindowFocus: false, | ||
| refetchOnReconnect: false, | ||
| retry: false, | ||
| meta: { showToastError: true }, | ||
| }, | ||
| mutations: { | ||
| cacheTime: 0, | ||
| retry: false, | ||
| meta: { showToastError: true }, | ||
| }, | ||
| }, | ||
| queryCache: new QueryCache({ | ||
| onError: (error, query) => { | ||
| if (query.meta.showToastError) { | ||
| showError(error) | ||
| } | ||
| }, | ||
| }), | ||
| mutationCache: new MutationCache({ | ||
| onError: (error, _variables, _context, mutation) => { | ||
| if (mutation.meta.showToastError) { | ||
| showError(error) | ||
| } | ||
| }, | ||
| }), | ||
| }) | ||
|
|
||
| export const QueryClientProvider = ({ children }: PropsWithChildren<{}>) => ( | ||
| <RQQueryClientProvider client={queryClient}>{children}</RQQueryClientProvider> | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,23 @@ | ||
| import { | ||
| QueryKey, | ||
| useMutation as rqUseMutation, | ||
| UseMutationOptions, | ||
| UseMutationResult, | ||
| useQuery as rqUseQuery, | ||
| useQueryClient, | ||
| UseQueryOptions, | ||
| UseQueryResult, | ||
| } from '@tanstack/react-query' | ||
|
|
||
| import { ServerErrors } from '@Common/ServerError' | ||
| import { ResponseType } from '@Common/Types' | ||
|
|
||
| export const useQuery = <TQueryFnData = unknown, TData = TQueryFnData, TQueryKey extends QueryKey = QueryKey>( | ||
| options: UseQueryOptions<ResponseType<TQueryFnData>, ServerErrors, TData, TQueryKey>, | ||
| ): UseQueryResult<TData, ServerErrors> => rqUseQuery(options) | ||
|
|
||
| export const useMutation = <TData = unknown, TVariables = void, TContext = unknown>( | ||
| options: UseMutationOptions<ResponseType<TData>, ServerErrors, TVariables, TContext>, | ||
| ): UseMutationResult<ResponseType<TData>, ServerErrors, TVariables, TContext> => rqUseMutation(options) | ||
|
|
||
| export { useQueryClient } |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.