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: move the default query client to outside of the component #437

Merged
merged 1 commit into from
May 6, 2024

Conversation

ugur-eren
Copy link
Contributor

@ugur-eren ugur-eren commented May 1, 2024

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.

@ugur-eren ugur-eren requested a review from fracek as a code owner May 1, 2024 11:55
Copy link

netlify bot commented May 1, 2024

Deploy Preview for starknet-react ready!

Name Link
🔨 Latest commit 1ab99de
🔍 Latest deploy log https://app.netlify.com/sites/starknet-react/deploys/6632363e0d28e1000823f1eb
😎 Deploy Preview https://deploy-preview-437--starknet-react.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify site configuration.

@fracek
Copy link
Contributor

fracek commented May 6, 2024

Good catch, thank you!

@fracek fracek merged commit ffa854a into apibara:main May 6, 2024
5 checks passed
@github-actions github-actions bot mentioned this pull request May 6, 2024
fracek added a commit that referenced this pull request May 21, 2024
This PR was opened by the [Changesets
release](https://github.com/changesets/action) GitHub action. When
you're ready to do a release, you can merge this and the packages will
be published to npm automatically. If you're not ready to do a release
yet, that's fine, whenever you add more changesets to main, this PR will
be updated.


# Releases
## @starknet-react/core@2.8.1

### Patch Changes

- [#437](#437)
[`1ab99de`](1ab99de)
Thanks [@ugur-eren](https://github.com/ugur-eren)! - Move the default
query client to outside of the Provider component
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