Description
useWallet at app/src/hooks/useWallet.ts:6 throws when the wallet context is
falsy, but WalletProvider at app/src/providers/WalletProvider.tsx:40
creates the context with a real default object (behind a @ts-ignore), so
that throw branch can never execute.
Steps to reproduce
- Render any component that calls
useWallet() without wrapping it in
WalletProvider.
- Observe that it returns the default context object instead of throwing.
Expected vs actual behavior
Expected: calling useWallet() outside a WalletProvider throws, since
the hook exists to guard against exactly that.
Actual: it silently returns the default context object, so the guard
never fires.
Additional context
app/src/components/NetworkPill.test.tsx depends on exactly this behavior —
it renders NetworkPill with no WalletProvider and asserts the
deterministic disconnected state that only works because useWallet()
doesn't throw. Fixing the guard to actually throw will turn that test red;
whoever picks this up needs to wrap that test's render in WalletProvider or
a stub context, which is a two-line change, not a redesign.
Description
useWalletatapp/src/hooks/useWallet.ts:6throws when the wallet context isfalsy, but
WalletProvideratapp/src/providers/WalletProvider.tsx:40creates the context with a real default object (behind a
@ts-ignore), sothat throw branch can never execute.
Steps to reproduce
useWallet()without wrapping it inWalletProvider.Expected vs actual behavior
Expected: calling
useWallet()outside aWalletProviderthrows, sincethe hook exists to guard against exactly that.
Actual: it silently returns the default context object, so the guard
never fires.
Additional context
app/src/components/NetworkPill.test.tsxdepends on exactly this behavior —it renders
NetworkPillwith noWalletProviderand asserts thedeterministic disconnected state that only works because
useWallet()doesn't throw. Fixing the guard to actually throw will turn that test red;
whoever picks this up needs to wrap that test's render in
WalletProviderora stub context, which is a two-line change, not a redesign.