Skip to content

perf+cleanup: kill ethers, unify typography, delete 2.5K LOC of dead bridge UI#3188

Merged
drewstone merged 1 commit intodevelopfrom
feat/finish-perf-debt
May 7, 2026
Merged

perf+cleanup: kill ethers, unify typography, delete 2.5K LOC of dead bridge UI#3188
drewstone merged 1 commit intodevelopfrom
feat/finish-perf-debt

Conversation

@drewstone
Copy link
Copy Markdown
Contributor

Closes the last bullet of perf debt called out in #3187. Three coordinated changes.

Bundle delta

Asset Before After Cut
crypto polyfill chunk 682 KB 84 KB -88%
ui-components LOC -2,564 dead-code purge
Typography drift 13 shims 1 canonical unified

What ships

  1. @ethersproject/* + ethers@5 deleted, taking the entire 600KB crypto-browserify transitive tree with it (bn.js, elliptic, browserify-sign, pbkdf2, public-encrypt, diffie-hellman). Audit found ethers had ZERO live consumers — three orphan utility files exported but never imported. Removed 'crypto' from nodePolyfills.include in both apps' vite configs.

  2. Typography unified: apps/tangle-cloud/src/components/Text.tsx is now the single canonical Text component (4 brand-aligned variants + 6 legacy aliases) consumed by all 416 existing call sites. 13 per-page shims removed; 14 files updated. SandboxUi.tsx re-exports the canonical so deep import paths (@/sandbox/SandboxUi) keep working.

  3. Dead bridge UI deleted (~2,564 LOC across 31 files): BridgeInputs/, BridgeFeeDetails/, cascade orphans (DepositCard/, TransferCard/, WithdrawCard/), duplicate DropdownField, orphaned story files. AdjustAmount + AnimatedChevronRight relocated to their actual consumers (TransactionInputCard, Dropdown) instead of deleted — tightens the dep graph.

Cumulative wins (vs pre-overhaul baseline)

  • tangle-dapp main index: 3.36MB → 788KB (-77%)
  • crypto polyfill: 682KB → 84KB (-88%)
  • tangle-cloud font payload: 1.19MB → 0 (-100%)
  • Total LOC removed across all overhaul PRs: -7,000+

Verified: typecheck + lint + test + build pass on both apps.

…2.5K LOC of unused bridge UI

Three coordinated changes closing the last bullet of perf debt called
out in #3187.

────────────────────────────────────────────────────────────────────────

1. Crypto polyfill: 682KB → 84KB (-600KB, -88%)
   Audited every consumer of node:crypto in the eager graph. The whole
   600KB was pulled by ethers@5 (transitive crypto-browserify, bn.js,
   elliptic, browserify-sign, pbkdf2, public-encrypt, diffie-hellman).
   ethers had ZERO live consumers — just three orphan utility files
   exported but never imported. Deleted them, dropped ethers + the two
   @ethersproject/* packages from package.json, removed 'crypto' from
   nodePolyfills.include in both apps.

   Residual 84KB chunk is legitimate Buffer/process polyfills that
   wagmi/walletconnect actually need. Removing those would require
   per-consumer Buffer.from() audit — much smaller payoff (~24KB
   gzipped), much bigger risk.

2. Typography unified under one canonical Text component
   tangle-cloud had 13 separate local Text shims declaring slightly
   different variant unions. Drift made every page look subtly off.

   Added apps/tangle-cloud/src/components/Text.tsx with 4 canonical
   variants ('h1'-'h4', 'body-lg', 'body', 'body-sm', 'caption') and
   6 legacy aliases ('h4' → h2, 'body1' → body-lg, 'body2' → body,
   'body3'/'body4' → body-sm) so all 416 existing call sites work
   unchanged. Maps to brand 0.3 typography tokens via Tailwind's
   font-display + size scale.

   Replaced shims in 14 files. SandboxUi.tsx and
   SandboxModalPrimitives.tsx now re-export from the canonical so
   the deep '@/sandbox/SandboxUi' / './SandboxModalPrimitives' import
   paths keep working without churn.

3. BridgeInputs + BridgeFeeDetails + cascade orphans deleted (~2,564 LOC)
   Killed 31 dead files now that the bridge surface is fully gone:
   - libs/ui-components/src/components/BridgeInputs/ (15 files, 1,542 LOC)
   - libs/ui-components/src/containers/BridgeFeeDetails/ (3 files, 174 LOC)
   - Cascade orphans (only existed to compose BridgeInputs):
     DepositCard/, TransferCard/, WithdrawCard/
   - components/DropdownField/DropdownField.tsx (duplicate of
     Dropdown/DropdownField.tsx, no consumers)
   - 3 orphaned .stories.jsx files

   Two transitively-used pieces (AdjustAmount, AnimatedChevronRight)
   relocated to their actual consumers (TransactionInputCard, Dropdown)
   instead of deleted, tightening the dep graph.

────────────────────────────────────────────────────────────────────────

Cumulative bundle deltas (vs pre-overhaul baseline):

| Asset                        | Pre-overhaul | Now    | Total cut |
| tangle-dapp main `index`     | 3.36 MB      | 788 KB | -77%      |
| crypto polyfill chunk        | 682 KB       | 84 KB  | -88%      |
| tangle-cloud font payload    | 1.19 MB      | 0      | -100%     |
| Typography drift             | 13 shims     | 1 cano | unified   |
| LOC removed across all PRs   | -            | -7,000+ | -        |

Verified: typecheck + lint + test + build pass on both apps.
@drewstone drewstone requested a review from AtelyPham as a code owner May 7, 2026 21:54
@netlify
Copy link
Copy Markdown

netlify Bot commented May 7, 2026

Deploy Preview for tangle-cloud failed. Why did it fail? →

Name Link
🔨 Latest commit cd1bc48
🔍 Latest deploy log https://app.netlify.com/projects/tangle-cloud/deploys/69fd0a269250750008105527

@netlify
Copy link
Copy Markdown

netlify Bot commented May 7, 2026

Deploy Preview for tangle-dapp failed. Why did it fail? →

Name Link
🔨 Latest commit cd1bc48
🔍 Latest deploy log https://app.netlify.com/projects/tangle-dapp/deploys/69fd0a26eda72a00084087a5

@netlify
Copy link
Copy Markdown

netlify Bot commented May 7, 2026

Deploy Preview for tangle-leaderboard failed. Why did it fail? →

Name Link
🔨 Latest commit cd1bc48
🔍 Latest deploy log https://app.netlify.com/projects/tangle-leaderboard/deploys/69fd0a26eda72a00084087aa

@drewstone drewstone merged commit 0e110a1 into develop May 7, 2026
1 of 9 checks passed
@drewstone drewstone deleted the feat/finish-perf-debt branch May 7, 2026 21:54
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.

1 participant