Skip to content

Commit

Permalink
Fix the useEffect dependency in auto-connect (#273)
Browse files Browse the repository at this point in the history
* Fix dependency array

Update changeset and fix typos in `CONTRIBUTING.md`

Fix more typos

* Clarify changeset reason
  • Loading branch information
xbtmatt authored May 9, 2024
1 parent 446beb5 commit 92a1801
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 8 deletions.
5 changes: 5 additions & 0 deletions .changeset/odd-dingos-lie.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@aptos-labs/wallet-adapter-react": patch
---

Fixed the `useEffect` dependency array for auto-connecting to be `[wallets]` instead of `wallets`
6 changes: 3 additions & 3 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Aptos Wallet Adapter is a monorepo built with [turbo](https://turbo.build/repo/d
#### Apps Workspace

The App workspace hold different web apps such as the adapter demo app (a nextjs app).
You are welcome to add different apps (react/vue/etc) in this workspace (make sure you are following turbo best pratices on how to do it)
You are welcome to add different apps (react/vue/etc) in this workspace (make sure you are following turbo best practices on how to do it)

#### Packages Workspace

Expand All @@ -18,7 +18,7 @@ The packages workspace holds 2 main packages
1. `wallet-adapter-core` - the core adapter logic that responsible on the adapter functionality, state and the interaction between the dapp and wallet.
2. `wallet-adapter-react` - a light react provider that dapps can import and use the adapter.

You are welcome to add packages (vue-provider/UI frameworks/etc) in this workspace (make sure you are following turbo best pratices on how to do it)
You are welcome to add packages (vue-provider/UI frameworks/etc) in this workspace (make sure you are following turbo best practices on how to do it)

### Develop Locally

Expand All @@ -30,7 +30,7 @@ You would need `[email protected]` in order to bootstrap and test a local copy of this

### Creating a pull request

You are welcome to create a pull reuqest against the `main` branch.
You are welcome to create a pull request against the `main` branch.

Before creating a PR

Expand Down
6 changes: 3 additions & 3 deletions packages/wallet-adapter-core/src/WalletCore.ts
Original file line number Diff line number Diff line change
Expand Up @@ -126,9 +126,9 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
constructor(plugins: ReadonlyArray<Wallet>) {
super();
this._wallets = plugins;
// Stretegy to detect legacy wallet adapter v1 wallet plugins
// Strategy to detect legacy wallet adapter v1 wallet plugins
this.scopePollingDetectionStrategy();
// Stretegy to detect AIP-62 standard compatible wallets
// Strategy to detect AIP-62 standard compatible wallets
this.fetchAptosWallets();
}

Expand Down Expand Up @@ -869,7 +869,7 @@ export class WalletCore extends EventEmitter<WalletCoreEvents> {
return pendingTransaction;
}

// Else have the adpater submits the transaction
// Else have the adapter submit the transaction

const aptosConfig = new AptosConfig({
network: convertNetwork(this.network),
Expand Down
2 changes: 1 addition & 1 deletion packages/wallet-adapter-react/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
> **_NOTE:_** This documentation is for Wallet Adapter `v2.0.0` and up that is fully comatible with the Aptos TypeScript SDK V2. For Wallet Adapter `v^1.*.*` refer to [this guide](./READMEV1.md)
> **_NOTE:_** This documentation is for Wallet Adapter `v2.0.0` and up that is fully compatible with the Aptos TypeScript SDK V2. For Wallet Adapter `v^1.*.*` refer to [this guide](./READMEV1.md)
# Wallet Adapter React Provider

Expand Down
2 changes: 1 addition & 1 deletion packages/wallet-adapter-react/src/WalletProvider.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -160,7 +160,7 @@ export const AptosWalletAdapterProvider: FC<AptosWalletProviderProps> = ({
setIsLoading(false);
}
}
}, wallets);
}, [wallets]);

useEffect(() => {
if (connected) {
Expand Down

0 comments on commit 92a1801

Please sign in to comment.