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

feat: enhanced provider API / @tanstack/react-query peer dependency #1934

Merged
merged 14 commits into from
May 17, 2024

Conversation

magiziz
Copy link
Contributor

@magiziz magiziz commented Apr 17, 2024

Changes

  • Added @tanstack/react-query as a peer dependency and introduced enhanced provider API.
  • Implemented fallback to fetch ENS name from enhanced provider API when mainnet is unavailable.

What to test

@magiziz magiziz requested a review from a team as a code owner April 17, 2024 12:50
Copy link

vercel bot commented Apr 17, 2024

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

Name Status Preview Comments Updated (UTC)
rainbowkit-example ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2024 7:56am
rainbowkit-site ✅ Ready (Inspect) Visit Preview 💬 Add feedback May 17, 2024 7:56am

@DanielSinclair
Copy link
Collaborator

@magiziz Noticed the address -> resolved name is a bit slow, even after the first fetch. Seeing a few network requests after leaving the page idle too. Are we taking advantage of react-query caching? https://github.com/rainbow-me/rainbowkit/assets/4412473/307f133e-0b26-49dd-b092-91b215adaf9d

@DanielSinclair
Copy link
Collaborator

Also pushed up some tweaks, mainly one that injects the API key at build-time. This can be a bit messy because it also needs to be available within the CI tests (where we can't statically replace the API key). Lmk if you have other thoughts! It will be skipped in CI here because we need to add a new ENV.

Copy link
Collaborator

@DanielSinclair DanielSinclair left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When replicating a 401, I noticed we throw console errors and try to re-fetch every few seconds. We should fail more gracefully because we may wind down this API endpoint some day. Max retry should be limited, and we should only need to fetch once at first-render if the caching is working appropriately
Screenshot 2024-05-07 at 2 36 14 AM

import { describe, expect, it } from 'vitest';
import { enhancedProviderHttp } from './enhancedProvider';

describe.skip('createHttpClient', () => {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Will do a follow up PR to fix this unit test. Faces issues with github secrets and process.env, but we can run this locally for now.

@DanielSinclair
Copy link
Collaborator

Force pushed to cleanup the git history here

@DanielSinclair DanielSinclair merged commit 90d6931 into main May 17, 2024
9 checks passed
@DanielSinclair DanielSinclair deleted the @mago/enhanced-provider branch May 17, 2024 07:59
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