wallet-selector icon indicating copy to clipboard operation
wallet-selector copied to clipboard

Race condition with old (Dec 2021) versions of near-api-js dep...

Open branfts opened this issue 3 years ago • 1 comments

Describe the bug After attending the Wallet Standards Working Group Meeting this past Friday, we decided to implement wallet-selector vs the old way of doing things and continued to see a race condition exactly as here https://github.com/near/near-api-js/issues/817. After finding that issue, as well as https://github.com/near/near-api-js/pull/842 and upgrading the library to current @1.1.0 the problem went away. Note it had to forced it using the command below due to this project deps. Is there a reason such an old version and not the latest is being used here? Can you upgrade the dep...

Assuming most developers are using relatively up to date versions of near-api-js... I would think a lot more people are running into this same issue...

npm install --legacy-peer-deps [email protected]

Seems the issue was fixed here https://github.com/near/near-api-js/pull/842...

To Reproduce https://github.com/near/near-api-js/issues/817

Expected behavior Expect no race condition to exist.

Device (please complete the following information):

  • OS: Windows
  • Browser: Edge
  • Version: Version 106.0.1370.42 (Official build) (64-bit)

branfts avatar Oct 23 '22 19:10 branfts

Hey, @branfts thanks for raising this issue! We will take a look at it, and regarding the question of why the latest version isn't being used, you can find the replies to similar raised issues and PRs on that topic here and here.

AmmarHumackicSQA avatar Oct 25 '22 14:10 AmmarHumackicSQA

Hey, @branfts near-api-js is just a peerDependency dApps can use any version equal or higher than ^v0.44.2.

Are you having trouble installing the latest version with npm?

Eventually we will need to update the range to v1.0.0 but as mentioned in the above links provided by @AmmarHumackicSQA we decided to postpone updating the range since the v0.44.2 had the most downloads and we did not encounter any issues.

kujtimprenkuSQA avatar Nov 03 '22 20:11 kujtimprenkuSQA

Like I said, I had to force the install otherwise I continued getting an error that was linked to the earlier version usage. Basically, npm would not install a version higher than v0.44.2 (in my dApp), I assume due to the peerDependency of wallet-selector. In order to use a more recent version of near-api-js (1.1.0) I had to use the --legacy-peer-deps ...

node: v16.17.0 npm: 8.19.1

branfts avatar Nov 07 '22 16:11 branfts

@branfts thank you for your feedback, we tend to use yarn in our project(s) and haven't encountered this issue. We will discuss this internally and see if we should update the range.

kujtimprenkuSQA avatar Nov 08 '22 09:11 kujtimprenkuSQA

Hey, @branfts I have been testing out Wallet Selector packages in different examples/dApps outside our NX project.

I can not seem to be able to reproduce the need for adding --legacy-peer-deps when installing the more recent or the latest version of near-api-js.

What I initially did was to first install some of the Wallet Selector packages that have near-api-js as a peerDependency like: @near-wallet-selector/core, @near-wallet-selector/modal-ui, @near-wallet-selector/my-near-wallet and after that I just run:

npm install near-api-js

This was run without any issues and the v1.1.0 of near-api-js was installed successfully.

kujtimprenkuSQA avatar Nov 11 '22 14:11 kujtimprenkuSQA

No worries. Maybe it was an issue on my end. I'll open it back up if needed. Thanks a bunch.

branfts avatar Nov 11 '22 19:11 branfts