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

[frontend] upgrade to react-query v5 #14346

Merged
merged 24 commits into from
Oct 24, 2023
Merged

Conversation

williamrobertson13
Copy link
Contributor

@williamrobertson13 williamrobertson13 commented Oct 19, 2023

Description

This PR upgrades our codebase and frontend SDKs to use react-query v5 which was released yesterday. @Jordan-Mysten did 98% of the work here (thx bud), but to cover the migration list/changes here:

https://tanstack.com/query/v5/docs/react/guides/migrating-to-v5

  • Explicitly set initialPageParam to null for all infinite queries (this starts us at the first page)
  • Modified typings for useSuiClientQuery and useSuiClientInfiniteQuery to support data transformations via select
  • Removed onSuccess, onError, onSettled callbacks on useQuery in favor of side effects
  • Renamed isLoading -> isPending which would be equivalent in the pre-v5 world
  • Replaced deprecated isInitialLoading with isLoading which is now equivalent
  • Replaced keepPreviousData property with placeholderData: keepPreviousData
  • Replaced dehydrateQueries with shouldDehydrateQuery
  • Renamed cacheTime -> gcTime

As a side note, the whole isPending vs isLoading concept is pretty confusing to wrap your ahead around. I didn't change anything functionality-wise, but that isn't to say that we're using the correct status field everywhere in our codebase:

isPending = no data is available (e.g. the query is disabled)
isLoading = we're actively fetching data

Test Plan

  • Going to manually test all of our applications and core flows work as expected just in case we missed something
  • Won't land this until next week when we've done said testing ^
  • Existing tests
  • CI

If your changes are not user-facing and not a breaking change, you can skip the following section. Otherwise, please indicate what changed, and then add to the Release Notes section as highlighted during the release process.

Type of Change (Check all that apply)

  • protocol change
  • user-visible impact
  • breaking change for a client SDKs
  • breaking change for FNs (FN binary must upgrade)
  • breaking change for validators or node operators (must upgrade binaries)
  • breaking change for on-chain data layout
  • necessitate either a data wipe or data migration

Release notes

@williamrobertson13 williamrobertson13 self-assigned this Oct 19, 2023
@vercel
Copy link

vercel bot commented Oct 19, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
sui-typescript-docs ✅ Ready (Inspect) Visit Preview 💬 Add feedback Oct 24, 2023 8:38pm
4 Ignored Deployments
Name Status Preview Comments Updated (UTC)
explorer ⬜️ Ignored (Inspect) Visit Preview Oct 24, 2023 8:38pm
multisig-toolkit ⬜️ Ignored (Inspect) Visit Preview Oct 24, 2023 8:38pm
mysten-ui ⬜️ Ignored (Inspect) Visit Preview Oct 24, 2023 8:38pm
sui-kiosk ⬜️ Ignored (Inspect) Visit Preview Oct 24, 2023 8:38pm

@williamrobertson13 williamrobertson13 changed the title [apps/dapp-kit] upgrade to react-query v5 [frontend] upgrade to react-query v5 Oct 19, 2023
@vercel vercel bot temporarily deployed to Preview – mysten-ui October 19, 2023 15:31 Inactive
@vercel vercel bot temporarily deployed to Preview – mysten-ui October 19, 2023 15:34 Inactive
@vercel vercel bot temporarily deployed to Preview – mysten-ui October 19, 2023 16:14 Inactive
@vercel vercel bot temporarily deployed to Preview – mysten-ui October 19, 2023 16:21 Inactive
@williamrobertson13 williamrobertson13 changed the title [frontend] upgrade to react-query v5 [frontend][wip] upgrade to react-query v5 Oct 24, 2023
@williamrobertson13 williamrobertson13 changed the title [frontend][wip] upgrade to react-query v5 [frontend] upgrade to react-query v5 Oct 24, 2023
@williamrobertson13 williamrobertson13 merged commit d4d9c92 into main Oct 24, 2023
35 checks passed
@williamrobertson13 williamrobertson13 deleted the wrobertson/v5_query branch October 24, 2023 21:23
jonas-lj pushed a commit to jonas-lj/sui that referenced this pull request Nov 2, 2023
## Description 

This PR upgrades our codebase and frontend SDKs to use react-query v5
which was released yesterday. @Jordan-Mysten did 98% of the work here
(thx bud), but to cover the migration list/changes here:

https://tanstack.com/query/v5/docs/react/guides/migrating-to-v5

- Explicitly set `initialPageParam` to null for all infinite queries
(this starts us at the first page)
- Modified typings for `useSuiClientQuery` and
`useSuiClientInfiniteQuery` to support data transformations via `select`
- Removed onSuccess, onError, onSettled callbacks on `useQuery` in favor
of side effects
- Renamed `isLoading` -> `isPending` which would be equivalent in the
pre-v5 world
- Replaced deprecated `isInitialLoading` with `isLoading` which is now
equivalent
- Replaced `keepPreviousData` property with `placeholderData:
keepPreviousData`
 - Replaced `dehydrateQueries` with `shouldDehydrateQuery`
 - Renamed `cacheTime` -> `gcTime`


As a side note, the whole `isPending` vs `isLoading` concept is pretty
confusing to wrap your ahead around. I didn't change anything
functionality-wise, but that isn't to say that we're using the correct
status field everywhere in our codebase:

`isPending` = no data is available (e.g. the query is disabled)
`isLoading` = we're actively fetching data

## Test Plan 
- Going to manually test all of our applications and core flows work as
expected just in case we missed something
- Won't land this until next week when we've done said testing ^
- Existing tests
- CI

---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.

### Type of Change (Check all that apply)

- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration

### Release notes

---------

Co-authored-by: Jordan Gensler <[email protected]>
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.

4 participants