Skip to content

refactor(app): split CapTableDashboard write/refresh orchestrator #262

Description

@ThatAlexPalmer

app/src/components/cap-table/CapTableDashboard.tsx is ~977 lines. Views (HoldingsView, IssueStockView, …) are already extracted; the leftover problem is that one component still owns every company-workspace side effect.

Today it holds:

  • four useDirect* hooks + four handle* write functions (class, shareholder, issuance, transfer)
  • optimistic in-flight rows + 90s TTL + pending flags
  • issuer deployed_to self-heal fetch
  • soft reconcile on open + Refresh
  • activity log (localStorage) + historical TX load
  • success/error modal + wallet/contract readiness gates
  • view routing via ?view=

That is not a bug. It is hard to review, easy to regress (ghost classes, first-issuance dropdown, optimistic dedupe), and it mixes UI chrome with write-path policy that WARP.md already documents in prose.

What’s wrong

  • Write handlers duplicate the same sequence: require wallet → submit → wait receipt → /register-onchain (except transfer) → optimistic row → activity.
  • Effects for heal/reconcile/history are inline and depend on manager in ways that are easy to stale-close over.
  • Nothing in this file is unit-tested; nav/ownership tests sit next to it but do not cover the handlers.

Suggested split (keep behavior)

Extract hooks, do not invent a new write protocol:

  • useIssuerHeal / useIssuerReconcile
  • useCapTableWrites (the four handlers + optimistic state)
  • leave view switching + layout in the dashboard

Do not delete /register-onchain, optimistic TTL, or transfer-via-poller-only.

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions