Uniswap / web3-react

A simple, maximally extensible, dependency minimized framework for building modern Ethereum dApps
https://web3-react-mu.vercel.app/
GNU General Public License v3.0
5.56k stars 1.52k forks source link

Updating connectors #184

Closed pedrouid closed 2 years ago

pedrouid commented 3 years ago

Hey @NoahZinsmeister, I was just talking to @marekkirejczyk about how web3-react needs to publish new update every time one of the provider like WalletConnect upgrades on NPM and then we need to release it as well with web3-react

For example the PR #177 that is still pending. And below you can see that this has been the case for other versions in the past

Screen Shot 2021-04-13 at 17 22 24

Is this something that is exclusive to WalletConnect connector or all connectors require it?

Is there any solutions around it or something needs to be fixed to change it?

Let us know because we are both interested to collaborate and change it if necessary

NoahZinsmeister commented 3 years ago

in theory semver should just handle this. the ^ should match any patch/minor, so you should be able to update by just upgrading the dependency with no issues. majors probably require manual changes so shouldn't be matched automatically

marekkirejczyk commented 3 years ago

@NoahZinsmeister If you use ^ in dependency of connector, you will still need to update it's package.lock or yarn.lock in connector package, right?

What if we put a wallet npm (e.g. Fortmatic) as peerDependencies in Connector (e.g. FortmaticConnector). Than DApp developer can pick the version of npm himself. It is a bit more tricky cause them need to put both Wallet npm and Connector npm in dependencies.

pedrouid commented 3 years ago

Yeah I guess it's strange where many times I've had requests from projects to update web3-react in order for them to have the latest WalletConnect version

Assuming they have a lot of dependencies they don't completely reset their package-loc and break something unexpectedly

So I will look into solutions for them to update a single dependency (or nested dependency) in the package-lock

NoahZinsmeister commented 3 years ago

yeah the peerDependecies approach isn't unreasonable. the real benefit to that would be that you could bump the package in question without also being forced to bump the entire connector (which in theory is fine, but in practice a patch/minor in another dependency might break something else, as you pointed out pedro).

the feedback is appreciated, i'm actually working on a new version of the lib, so i will keep this in mind :) peerDependencies might be the way to go

pedrouid commented 3 years ago

i'm actually working on a new version of the lib

that's great to hear because I'm also working towards a new version of Web3Modal and Marek is working on useDapp

I think we can all collaborate and for example in my case I intend to refactor connectors to be shared with web3-react

given it's unnecessary for Web3Modal and web3-react to not share connectors when all Im doing is focusing on UI/UX while web3-react focuses on state management

this also would allow developers to use both libraries and in this manner delegating UI to Web3Modal without blocking them from using web3-react underneath

pcowgill commented 3 years ago

Oooh, having Web3Modal share connectors with web3-react would be amazing!

pedrouid commented 3 years ago

Hey @NoahZinsmeister, I've made a PR #187 that makes a small change that would make Web3Modal and web3-react compatible. Let me know when you get a chance to review it

NoahZinsmeister commented 2 years ago

closing - connectors in v8 use peerDependencies! @pedrouid still tracking #187 if you need it :)

jellohouse commented 2 years ago

What is the status on using web3modal with web3-react?

Is there an easy way now we can integrate them together?