Skip to content

Hoist OrderbookDepth icon components to module scope #32

@plind-junior

Description

@plind-junior

Why

BtcIcon, TaoIcon, and AssetIcon are declared inside OrderbookDepth (src/components/dashboard/OrderbookDepth.tsx:29-84). Every parent render creates new component types, so React unmounts and remounts the SVG subtrees.

Not a user-visible bug today — the icons are stateless SVGs, so the remount is invisible. But it violates React's "don't define components inside components" guidance and becomes a real bug if the icons ever gain state, refs, animations, or lazy children.

Fix

Hoist to module scope; each icon calls useTheme() internally. No prop threading, no React.memo.

Acceptance

  • Icons at module scope.
  • Colors read via useTheme() inside each icon.
  • Visual output unchanged (light + dark).
  • tsc --noEmit + lint pass.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions