-
Notifications
You must be signed in to change notification settings - Fork 187
feat(refactor): @apollo/client v3 - v4 migration
#3171
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
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR migrates the codebase from Apollo Client v3 to v4, introducing significant changes to the GraphQL client implementation and query patterns.
Key Changes
- Upgraded
@apollo/clientfrom v3.13.9 to v4.0.11 with new peer dependency onrxjsv7.8.2 - Refactored type system with new
QueryReturn<T>type that guarantees non-null data through default values - Updated all query hooks to use type parameters and return default values instead of null/undefined
- Changed Apollo Client initialization to use explicit
HttpLinkinstead ofurishorthand
Reviewed changes
Copilot reviewed 39 out of 40 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pnpm-lock.yaml | Updates Apollo Client package from v3.14.0 to v4.0.11, adds rxjs dependency, removes deprecated dependencies (hoist-non-react-statics, prop-types, react-is@16, rehackt, symbol-observable, ts-invariant, zen-observable) |
| packages/plugin-staking-api/package.json | Updates Apollo Client dependency specification to ^4.0.11 and adds rxjs ^7.8.2 |
| packages/plugin-staking-api/src/types.ts | Introduces QueryReturn type for v4, imports ApolloError from v4-migration package, refactors all Result types to Data types with flattened structure |
| packages/plugin-staking-api/src/Client.ts | Replaces uri shorthand with explicit HttpLink configuration |
| packages/plugin-staking-api/src/index.ts | Updates ApolloProvider import to @apollo/client/react, removes isActiveStaker export |
| packages/plugin-staking-api/src/queries/*.ts | Standardizes query pattern: imports useQuery from @apollo/client/react, adds DEFAULT constants, updates return types to use QueryReturn, uses type parameters in useQuery calls |
| packages/app/src/**/*.tsx | Updates consumer code to destructure new data structure, adjusts null handling patterns |
| packages/global-bus/src/networkConfig/util.ts | Updates type reference from RpcEndpointChainHealth to RpcEndpointHealthData and adjusts property access pattern |
Files not reviewed (1)
- pnpm-lock.yaml: Language not supported
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot <[email protected]>
…loud/polkadot-staking-dashboard into rb/apollo-4-migration
This PR migrates the codebase from Apollo Client v3 to v4, introducing significant changes to the GraphQL client implementation and query patterns.
Key Changes
@apollo/clientfrom v3.13.9 to v4.0.11 with new peer dependency onrxjsv7.8.2QueryReturn<T>type that guarantees non-null data through default valuesHttpLinkinstead ofurishorthand