apibara / starknet-react

A collection of React providers and hooks for StarkNet
https://starknet-react.com
MIT License
364 stars 141 forks source link

fix: move the default query client to outside of the component #437

Closed ugur-eren closed 4 months ago

ugur-eren commented 5 months ago

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.

netlify[bot] commented 5 months ago

Deploy Preview for starknet-react ready!

Name Link
Latest commit 1ab99de7b07d75af26e0804f0a2a26903eac1c9f
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 commented 4 months ago

Good catch, thank you!