Git Product home page Git Product logo

Comments (6)

iamssen avatar iamssen commented on August 15, 2024 2

#48

I separated the WalletController into a separate package. This no longer requires dependence such as react.

I am not going to change the API, so if possible, I would like you to install this alpha version and test it together.

from wallet-provider.

iamssen avatar iamssen commented on August 15, 2024

@Stradivario https://github.com/terra-money/wallet-provider/tree/main/templates/wallet-controller

Please refer to this link.

class WalletController, the under part of the wallet-provider, was created based on RxJs, and React APIs such as useWallet() bind it.

WalletController can be used directly if you want. However, it will not be as convenient as the React API.

However, since internal parts such as Modal still use React, it is still necessary to add package.json dependencies for React. (I will then work on removing React from internally)

from wallet-provider.

Stradivario avatar Stradivario commented on August 15, 2024

I check the code and i saw that here https://github.com/terra-money/wallet-provider/blob/main/packages/src/%40terra-money/wallet-provider/index.ts#L3

We are exporting ./impl-react and @terra-money/use-wallet which are libraries using react

So if i don't install react i will get the error 'react-dom' or 'react' cannot be found in dependency resolution.

Even if i install react i will get an error that i don't use the correct way react

Uncaught (in promise) Error: Invalid hook call. Hooks can only be called inside of the body of a function component. This could happen for one of the following reasons:
1. You might have mismatching versions of React and the renderer (such as React DOM)
2. You might be breaking the Rules of Hooks
3. You might have more than one copy of React in the same app
See https://reactjs.org/link/invalid-hook-call for tips about how to debug and fix this problem.
    at resolveDispatcher (react.development.js:1476)
    at useContext (react.development.js:1484)
    at useWallet (useWallet.ts:374)
    at TerraProvider.<anonymous> (terra.provider.ts:72)
    at Generator.next (<anonymous>)
    at terra.provider.ts:4
    at new Promise (<anonymous>)
    at __awaiter (terra.provider.ts:4)
    at TerraProvider.OnInit (terra.provider.ts:62)
    at ContainerInstance.getServiceValue (ContainerInstance.js:244)

So there is a big problem using it with other libraries or native.

I will write down a few things today and i will let you know if i can remove every usage of react and leave the core logic untouched. After that we can just connect the react with the generic controller.

Cheers and thanks for the fast response!

from wallet-provider.

iamssen avatar iamssen commented on August 15, 2024

@Stradivario Is this an error when you only use WalletController?

I will check this error tomorrow.

Unfortunately, it still needs to install react, react-dom, and styled-components in your dependencies. The reason why React exists in multiple copies may be because node_modules is not flat. (If you add react, react-dom, and styled-components to your dependencies and the problem continues, try npm deadupe or yarn dedupe)

Anyway, I'll look into this tomorrow.

from wallet-provider.

iamssen avatar iamssen commented on August 15, 2024

https://github.com/terra-money/wallet-provider/releases/tag/v3.2.0

from wallet-provider.

Stradivario avatar Stradivario commented on August 15, 2024

Hey @iamssen thanks for the effort doing these changes!

I will try it out today and will write down how the things are going.

I am sorry for the late reply but i am having some production deployments and i don't have much time to test this out.

Cheers!

from wallet-provider.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.