Skip to content

Bound the connect wait and reconcile a late completion #105

Description

@gabitoesmiapodo

Description

canton-connect puts no bound of its own on sdk.connect(). #49 fixed the reported cases by polling popup.closed in guardedConnect, which covers closes only. A wallet that opens, sits and never answers with its window still open leaves isConnecting true forever, and a consumer cannot recover: connect() exposes no abort.

Steps to reproduce

  1. Render a consumer of useCantonConnect and call connect()
  2. Pick a wallet in the picker
  3. Leave the wallet window open and never approve or reject
  4. Observe isConnecting stays true, with no error and no way to cancel

Expected vs actual behavior

Expected: the wait ends at a documented bound, connectError is set and isConnecting returns to false; a completion landing after that bound is reconciled into the connected state.
Actual: isConnecting stays true indefinitely and only a reload clears it.

Additional context

Split from #49. Blocked by BootNodeDev/cn-dappbooster#85.

Scope:

  • Add connectTimeoutMs to CantonConnectConfig with a documented default
  • On expiry set connectError and run the same sdk.status() probe the cancelled path uses, so a session that survived the attempt is kept
  • Route a late success into connected with the party populated, instead of showing disconnected over a live session — write this half first
  • Keep the SDK on timeout: the Closing a wallet or picker window leaves connect() stuck #49 picker-close path retires the DappSDK precisely so no late completion can land, but here the window may still be open and the user may still finish
  • Reconcile during a live session too: an app-initiated cancel abandons the in-flight sdk.connect(), and a wallet-side disconnect push is byte-identical to a lock
  • Build on the xstate connection machine from feat: evolve the vesting dApp to Amulet on Splice LocalNet cn-dappbooster#85, on its connect actor, not in CantonConnectProvider.tsx; canton-connect/CLAUDE.md forbids a lifecycle rule living in both models

Tests:

  • A connect that never settles: isConnecting returns to false and connectError is set, with fake timers advanced inside act because waitFor polls on real timers
  • The reconcile path: settle after the timeout and assert the party appears

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

bugSomething isn't workingpriority: lowNice to have, can wait

Type

Projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions