mirror of
https://gitlab.com/soapbox-pub/mkstack.git
synced 2026-12-03 08:07:21 +00:00
When a user tapped "Open signer app", the dialog previously stayed frozen on the same screen — same button, same copy-URI fallback, no feedback — until the login either succeeded (and the dialog dismissed) or timed out after two minutes. With slow or flaky signers (Amber's current listening-REQ bug being the immediate trigger, but any NIP-46 signer that takes more than a second or two to respond hits the same hole) this looked indistinguishable from a hang. Users retapped the button, closed the dialog, gave up. Now the dialog swaps the QR / Open signer app area for a centered spinner with a live status line as the handshake advances: - "Waiting for signer connection…" while the signer app has the user and we're listening on kind 24133 for the connect-ack. - "Getting public key…" once the connect-ack arrives and we're issuing the NIP-46 get_public_key RPC. On mobile the swap happens synchronously when the user taps "Open signer app" so they see the progress state the moment they return from the signer. On desktop the QR stays visible through the awaiting-connect phase (they may still be scanning with a different device) and only swaps in once the signer has acknowledged. The progress view includes a Cancel link that aborts the in-flight subscription and regenerates fresh connect params. Also fix a related effect-lifecycle bug: the listening effect previously depended on `onClose` and `isWaitingForConnect`. Since parents pass inline arrow functions for onClose, the effect re-ran on every parent render and its cleanup flipped a local `cancelled` flag — if the signer's response arrived on a re-rendered instance, the success branch silently swallowed the login. The effect now depends only on `nostrConnectParams` with stable refs for onClose/login, gates the success branch on `controller.signal.aborted` instead of a teardown flag, and handles cancellation explicitly in the dialog-close and retry paths. The handshake phases are surfaced via the new `onStatus` callback on `NLogin.fromNostrConnect` in @nostrify/react 0.6.0. Bumps @nostrify/react to ^0.6.0. Also switches the fallback relay used for NIP-46 communication from wss://relay.damus.io to wss://relay.ditto.pub. Only applies when the user has no writable relays in their metadata. Incidental cleanup while editing the dialog: the Copy URI button and the "Open your signer app to connect." / "Scan with your signer app." caption lines are removed. The primary Open signer app button is self-explanatory on mobile, and the QR on desktop doesn't need a caption.