Problem
When consumers pass an inline array to the wallets prop:
<StacksWalletProvider wallets={['xverse', 'leather']}>
A new array reference is created on every render, which defeats the useMemo dependency check for walletInfos. This causes getStacksWallets() (which queries the DOM for installed extensions) to run on every render unnecessarily.
Fix
Either:
- Document that
wallets should be defined outside the component or wrapped in useMemo
- Accept and compare by value internally (e.g., serialize to a string key for the memo dep)
Context
Identified during code review of PR #2.
Problem
When consumers pass an inline array to the
walletsprop:A new array reference is created on every render, which defeats the
useMemodependency check forwalletInfos. This causesgetStacksWallets()(which queries the DOM for installed extensions) to run on every render unnecessarily.Fix
Either:
walletsshould be defined outside the component or wrapped inuseMemoContext
Identified during code review of PR #2.