这是indexloc提供的服务,不要输入任何密码
Skip to content

Changed Fetch Policy for currentUser Query. #69

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 5 commits into from
Jun 24, 2024

Conversation

asadamatic
Copy link
Contributor

Using cache is important to reduce the load on APIs, and to reduce loading times, but for things that may change frequently during the runtime, it would be better to go with network-only policy.

The ShopifyConfig.fetchPolicy sets the policy for all the queries, so if you want to use cache for products and collections, you'll have to opt-in to cache-first policy for all the queries. In case of currentUser query, I think this policy is not good, as the user will update their profile from the app. Some updates can be handled locally, but others may result in inconsistent data.

To resolve this, I have hardcoded the fetchPolicy for the currentUser query, as FetchPolicy.networkOnly.

@imsujan276 imsujan276 merged commit 72c04f4 into imsujan276:main Jun 24, 2024
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.

2 participants