Concordium / concordium-dapp-libraries

A coherent set of building blocks for making it as easy as possible for developers to build web-based dApps.
Apache License 2.0
7 stars 5 forks source link

react-components: Remove 'connectActive' method #15

Closed bisgardo closed 1 year ago

bisgardo commented 1 year ago

Purpose

Remove the responsibility of initiating connections from WithWalletConnector. This simplifies this component and takes away any confusion as to why there's more than one way to establish a connection (and what exactly each method does and doesn't).

The field activeConnection will be moved from from this component into a hook in the followup PR #20. This will leave WithWalletConnector as a much simpler component with a single clear responsibility.

Changes

Instead of using the connectActive method, one should just call connect directly on the connector which will then notify WithWalletConnector via its role as the connector's delegate. The application then calls setActiveConnection to set it as active if desired.

This means that activeConnectorError no longer holds errors for connections (only the connector's error as the name also implies) and that the isConnecting indicator no longer is maintained: It's now the application's job to track this state.

shjortConcordium commented 1 year ago

I'm not sure I understand the purpose/reason for this change? :thinking:

bisgardo commented 1 year ago

I'm not sure I understand the purpose/reason for this change? thinking

Are you asking me whether you understand the reason? :stuck_out_tongue: On a serious note, I updated the stated purpose; is it clearer now?