Skip to content
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

Prevent passing custom QueryClient instance to ServicesContext #10913

Open
Tracked by #11612 ...
mlqn opened this issue Aug 25, 2023 · 0 comments
Open
Tracked by #11612 ...

Prevent passing custom QueryClient instance to ServicesContext #10913

mlqn opened this issue Aug 25, 2023 · 0 comments
Assignees
Labels
kind/chore quality/code Violations from current rules for code, best practices, etc. Or just bad code. quality/testing Tests that are missing, needs to be created or could be improved. status/triage

Comments

@mlqn
Copy link
Contributor

mlqn commented Aug 25, 2023

Description

It's currently possible to pass a custom QueryClient instance to ServicesContext. This should not be allowed as it enables bypassing the error handling mechanism set in QueryCache and MutationCache.

The main challenge in resolving this task is that several of our tests use the setQueryData method of QueryClient. We may need to replace them with waitForData methods, as we have done in several other tests, but not sure if it's the best solution.

Another solution could be to retrieve the QueryClient instance using the useQueryClient hook when passing the component to test, but this might make the code less readable.

@mlqn mlqn added quality/code Violations from current rules for code, best practices, etc. Or just bad code. quality/debt Shortcuts made for saving time. Fixing this will make us more efficient going forward. labels Sep 22, 2023
@mlqn mlqn added quality/testing Tests that are missing, needs to be created or could be improved. area/test and removed quality/debt Shortcuts made for saving time. Fixing this will make us more efficient going forward. labels Jan 2, 2024
@mlqn mlqn mentioned this issue Aug 20, 2024
4 tasks
@mlqn mlqn self-assigned this Aug 21, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
kind/chore quality/code Violations from current rules for code, best practices, etc. Or just bad code. quality/testing Tests that are missing, needs to be created or could be improved. status/triage
Projects
Status: No status
Development

No branches or pull requests

2 participants