fix: move the default query client to outside of the component #437
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.
The current implementation of the query client within the function component leads to the creation of a new query client on each re-render. Consequently, this behavior results in the loss of data and caches associated with the query client.
This PR addresses the issue by relocating the default query client outside of the function component. By doing so, we ensure that the query client persists across re-renders, maintaining data integrity and cache consistency.
While it's possible to resolve this issue by directly providing the query client to the Provider on usage, this caused us some time to locate and fix the issue, hence the decision to refactor the implementation.