-
Notifications
You must be signed in to change notification settings - Fork 451
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: react hooks observers #1127
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Coverage report for
|
St.❔ |
Category | Percentage | Covered / Total |
---|---|---|---|
🟡 | Statements | 64.96% | 3261/5020 |
🔴 | Branches | 41.43% | 587/1417 |
🔴 | Functions | 48.44% | 681/1406 |
🟡 | Lines | 65.53% | 3144/4798 |
Test suite run success
236 tests passing in 72 suites.
Report generated by 🧪jest coverage report action from d49c95b
luizstacio
approved these changes
Mar 11, 2024
helciofranco
added a commit
that referenced
this pull request
Mar 11, 2024
I've removed `.tsx` extensions from our hooks on this PR #1127 Let's keep `.tsx` for files that have actual `JSX`.
helciofranco
pushed a commit
that referenced
this pull request
Mar 12, 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 master, this PR will be updated. # Releases ## @fuel-wallet/react@0.16.0 ### Minor Changes - [#1127](#1127) [`af8c470`](af8c470) Thanks [@helciofranco](https://github.com/helciofranco)! - fix: fuel hooks will only re-render tracked properties, instead of listening to every useQuery property. ## @fuel-wallet/connections@0.16.0 ### Patch Changes - Updated dependencies \[]: - @fuel-wallet/sdk@0.16.0 - @fuel-wallet/types@0.16.0 ## @fuel-wallet/sdk@0.16.0 ### Patch Changes - Updated dependencies \[]: - @fuel-wallet/types@0.16.0 ## @fuel-wallet/playwright-utils@0.16.0 ## @fuel-wallet/types@0.16.0 ## fuels-wallet@0.16.0 ### Minor Changes - [#1099](#1099) [`82fba09`](82fba09) Thanks [@helciofranco](https://github.com/helciofranco)! - Automatically identify seed phrase length and update the selected format to fit. ### Patch Changes - [#1081](#1081) [`15358f5`](15358f5) Thanks [@matt-user](https://github.com/matt-user)! - Use the packages migrated to fuels npm packs - [#1118](#1118) [`6585923`](6585923) Thanks [@helciofranco](https://github.com/helciofranco)! - truncates long account name correctly - Updated dependencies \[]: - @fuel-wallet/connections@0.16.0 - @fuel-wallet/sdk@0.16.0 - @fuel-wallet/types@0.16.0 Co-authored-by: github-actions[bot] <github-actions[bot]@users.noreply.github.com>
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
This is exactly the same implementation of FuelLabs/fuels-npm-packs#55
Applying here just for compatibility purposes (temporarily since this will be removed soon).
This PR fixes and reduces a lot of re-renders across our query observers.
This issue was caused due to the way which
@tanstack/react-query
handles the tracked properties to re-renders.Internally, they implemented a
Proxy
to intercept and track which properties a component is listening from auseQuery
hook.It means that when we're calling a
useQuery
with spread operators, it is forwarding to thatProxy
that we want to listen to EVERY existent property.So, what I did? I created the
useNamedQuery
that is also aProxy
and it'll also rename the data property to anything you want to name, and keeping the performance everywhere.This ensures we're going to re-render ONLY when
tracked
properties get updates.