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

fix: WRAPPER_REACT_QUERY.md #642

Merged

Conversation

AlirezaHadjar
Copy link
Contributor

This PR updates the integration of the react query with mmkv. I have also updates doc links


const App = () => {
return (
<PersistQueryClientProvider persistOptions={{ persister: clientPersister }}>
<QueryClientProvider client={queryClient}>
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

where's that import coming from?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QueryClientProvider is imported from "@tanstack/react-query".

I didn't add it since it's required even for basic usage as well.

@mrousavy should I add this to the top?

import { QueryClientProvider } from "@tanstack/react-query";

Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes please add that - then we can merge :)

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Done!

@mrousavy mrousavy merged commit 92f21f4 into mrousavy:master Mar 7, 2024
1 check passed
@mrousavy
Copy link
Owner

mrousavy commented Mar 7, 2024

awesome thanks!

@AlirezaHadjar AlirezaHadjar deleted the fix/react-query-intergration branch March 7, 2024 15:34
@fobos531
Copy link
Contributor

fobos531 commented Apr 5, 2024

@AlirezaHadjar Can you clarify why you replaced here the PersistQueryClientProvider with a different approach which just uses the persistQueryClient function? Isn't PersistQueryClientProvider more applicable, as also recommended by official docs of react-query?

@AlirezaHadjar
Copy link
Contributor Author

AlirezaHadjar commented Apr 6, 2024

@fobos531 in the case of no persister or any async persister the method you menthioned is recommended but as for sync persister, I could only find this method https://tanstack.com/query/latest/docs/framework/react/plugins/createSyncStoragePersister

@fobos531
Copy link
Contributor

fobos531 commented Apr 7, 2024

@fobos531 in the case of no persister or any persister the method you menthioned is recommended but as for sync persister, I could only find this method tanstack.com/query/latest/docs/framework/react/plugins/createSyncStoragePersister

You can find it here, with the example for the sync persister: https://tanstack.com/query/latest/docs/framework/react/plugins/persistQueryClient#persistqueryclientprovider

IMO this approach might be more preferable compared to the method mentioned in this PR. What do you think?

@AlirezaHadjar
Copy link
Contributor Author

@fobos531 in the case of no persister or any persister the method you menthioned is recommended but as for sync persister, I could only find this method tanstack.com/query/latest/docs/framework/react/plugins/createSyncStoragePersister

You can find it here, with the example for the sync persister: https://tanstack.com/query/latest/docs/framework/react/plugins/persistQueryClient#persistqueryclientprovider

IMO this approach might be more preferable compared to the method mentioned in this PR. What do you think?

As I checked both doc pages, I couldn't find any advantages of one to the other. Could you please elaborate on what do you mean by "preferable"?

@fobos531
Copy link
Contributor

fobos531 commented Apr 7, 2024

@fobos531 in the case of no persister or any persister the method you menthioned is recommended but as for sync persister, I could only find this method tanstack.com/query/latest/docs/framework/react/plugins/createSyncStoragePersister

You can find it here, with the example for the sync persister: tanstack.com/query/latest/docs/framework/react/plugins/persistQueryClient#persistqueryclientprovider
IMO this approach might be more preferable compared to the method mentioned in this PR. What do you think?

As I checked both doc pages, I couldn't find any advantages of one to the other. Could you please elaborate on what do you mean by "preferable"?

Primarily due to reasons listed in the screenshot below:

CleanShot 2024-04-07 at 17 24 53@2x

To be honest, I've never experienced issues described in that screenshot, but it convinced me to use that approach regardless.

@AlirezaHadjar
Copy link
Contributor Author

Correct!
I used this method as it is more similar to experimental persister. So could you please open a PR for the change?

@fobos531
Copy link
Contributor

fobos531 commented Apr 7, 2024

Correct! I used this method as it is more similar to experimental persister. So could you please open a PR for the change?

Sure: #658

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants