Fix React error #321 in BunkerLogin - invalid hook call
- Move useNostr() hook call from inside event handler to component level - Destructure bunkerLogin alongside bunkerLoginWithSigner at top level - React hooks must only be called at component level, not inside callbacks Files modified: - src/components/AccountManager/BunkerLogin.tsx: Fix hook placement 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
This commit is contained in:
@@ -19,7 +19,7 @@ export default function BunkerLogin({
|
||||
onLoginSuccess: () => void
|
||||
}) {
|
||||
const { t } = useTranslation()
|
||||
const { bunkerLoginWithSigner } = useNostr()
|
||||
const { bunkerLoginWithSigner, bunkerLogin } = useNostr()
|
||||
const [mode, setMode] = useState<'choose' | 'scan' | 'paste'>('choose')
|
||||
const [bunkerUrl, setBunkerUrl] = useState('')
|
||||
const [relayUrl, setRelayUrl] = useState(DEFAULT_BUNKER_RELAY)
|
||||
@@ -105,7 +105,6 @@ export default function BunkerLogin({
|
||||
|
||||
try {
|
||||
// Use the existing bunkerLogin flow for bunker:// URLs
|
||||
const { bunkerLogin } = useNostr()
|
||||
await bunkerLogin(bunkerUrl.trim())
|
||||
onLoginSuccess()
|
||||
} catch (err) {
|
||||
|
||||
Reference in New Issue
Block a user