Skip to content

refactor(OrderbookDepth): hoist icon components to module scope#33

Open
wmagev wants to merge 1 commit intoentrius:testfrom
wmagev:refactor/orderbook-icon-hoist
Open

refactor(OrderbookDepth): hoist icon components to module scope#33
wmagev wants to merge 1 commit intoentrius:testfrom
wmagev:refactor/orderbook-icon-hoist

Conversation

@wmagev
Copy link
Copy Markdown

@wmagev wmagev commented Apr 18, 2026

BtcIcon, TaoIcon, and AssetIcon were declared inside the OrderbookDepth render body, which created new component types on every parent render and caused React to unmount and remount the SVG subtrees.

Hoist all three to module scope. Each component calls useTheme() internally instead of closing over the parent's theme object. No prop threading, no React.memo.

Also inline the two remaining BTC_COLOR / TAO_COLOR aliases at the call sites where they're still needed.

Fixes the 'don't define components inside components' anti-pattern flagged against upstream PR #15, without adopting that PR's prop-threading or React.memo machinery.

Fixes #32

BtcIcon, TaoIcon, and AssetIcon were declared inside the OrderbookDepth
render body, which created new component types on every parent render
and caused React to unmount and remount the SVG subtrees.

Hoist all three to module scope. Each component calls useTheme()
internally instead of closing over the parent's theme object. No prop
threading, no React.memo.

Also inline the two remaining BTC_COLOR / TAO_COLOR aliases at the
call sites where they're still needed.

Fixes the 'don't define components inside components' anti-pattern
flagged against upstream PR entrius#15, without adopting that PR's
prop-threading or React.memo machinery.
nightmare0329 added a commit to nightmare0329/allways-ui that referenced this pull request Apr 18, 2026
…back

Issue entrius#33 — refactor(OrderbookDepth): hoist BtcIcon, TaoIcon, AssetIcon
to module scope so they are not recreated on every parent render.
Each icon calls useTheme() internally instead of closing over the
parent component's theme variables.

Issue entrius#31 — a11y: add aria-label to 4 icon-only interactive controls:
- Docs link button (aria-label="Documentation")
- Theme toggle button (dynamic: "Switch to dark/light mode")
- Orderbook info button (aria-label="Orderbook depth information")
- EventFeed scroll-to-top button (aria-label="Scroll to top of event feed")

Issue entrius#36 — fix: add QueryError component with retry button and wire it
into all four dashboard panels (StatsPanel, MinerRatesTable,
OrderbookDepth, EventFeed). Panels now render a QueryError with a refetch
button instead of staying on a shimmer skeleton when useApiQuery errors.

Closes entrius#31, entrius#33, entrius#36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Hoist OrderbookDepth icon components to module scope

1 participant