Skip to content

Add StrategyCardSkeleton component for the vault strategy comparison page - #1286

Merged
Junirezz merged 1 commit into
Junirezz:mainfrom
solaawojobi00-bit:fix/issue-1247-loading-skeletons
Aug 26, 2026
Merged

Add StrategyCardSkeleton component for the vault strategy comparison page#1286
Junirezz merged 1 commit into
Junirezz:mainfrom
solaawojobi00-bit:fix/issue-1247-loading-skeletons

Conversation

@solaawojobi00-bit

@solaawojobi00-bit solaawojobi00-bit commented Aug 26, 2026

Copy link
Copy Markdown
Contributor

Loading skeleton screens for major pages

Problem

Issue #1247 asks for loading skeleton screens across the vault dashboard, strategy picker, and portfolio page, with the skeleton shown on data-fetch start and hidden on completion, fallback content for SEO/accessibility, coverage under slow-network conditions, and a note on the performance impact.

Surface Skeleton coverage
Vault dashboard (VaultDashboard.tsx) Already wired to DashboardCardSkeleton / VaultStatSkeleton / SharePriceSkeleton via real React Query loading state (#911)
Portfolio page (Portfolio.tsx) Already wired to skeleton loading rows via real loading state (#911)
Strategy picker No page is literally named "strategy picker." The closest match is VaultComparison.tsx ("Compare Vault Strategies")

Solution

VaultComparison.tsx has no real async data source — VAULT_STRATEGIES is a local catalog (frontend/src/lib/vaultStrategies.ts), by design, until a GET /vault/strategies endpoint exists. I looked at wiring a loading gate into it and hit a real dead end:

  • A genuine delay (e.g. setTimeout) before content appears breaks all 20 of the page's existing synchronous tests (URL-state selection, sorting, announcements, plus 2 axe accessibility audits) — none of them await or advance timers, so nothing after the delay would be visible to any assertion.
  • The only delay compatible with those tests unmodified is a same-tick effect flip (useEffect(() => setIsLoading(false), [])), but that's exactly the anti-pattern the repo's own react-hooks/set-state-in-effect ESLint rule forbids ("you might not need an effect") — it would fail CI's lint step.

Faking either a real delay or a synchronous one both fail for good reasons, so this PR ships only the skeleton building block:

  • Added StrategyCardSkeleton to the shared Skeleton.tsx library, matching the visual shape of the real strategy comparison cards (issuer label, name, three metric rows, note line), consistent with the existing DashboardCardSkeleton / PortfolioCardSkeleton pattern.
  • It is not wired into VaultComparison.tsx yet. It's ready to drop in as soon as that page reads from a real endpoint instead of the local catalog — at that point the loading flag will come from the fetch itself, not a fake gate, and neither of the problems above will apply.

Changes

  • frontend/src/components/Skeleton.tsx — new StrategyCardSkeleton export.
  • frontend/src/components/Skeleton.test.tsx — added StrategyCardSkeleton to the shared variant-rendering test.

Regression Tests

Acceptance criterion (#1247) Status
Create skeleton components for vault dashboard, strategy picker, portfolio page Dashboard/portfolio already covered (#911); StrategyCardSkeleton added and unit-tested in Skeleton.test.tsx, not yet wired into a page (see Solution)
Show skeleton on data fetch start, hide on completion N/A for the strategy picker — no real fetch exists to gate on; dashboard/portfolio already do this (#911)
Add fallback content for SEO No change needed — VaultComparison.tsx already renders real, immediately-available content (no loading state to add a fallback for)
Test on slow network conditions Not applicable here; see Solution for why a simulated delay isn't viable on this page
Measure performance improvement metrics Not included — see Notes for Reviewers below

Testing

$ npx vitest run src/components/Skeleton.test.tsx
 Test Files  1 passed (1)
      Tests  6 passed (6)

$ npx eslint src/components/Skeleton.tsx src/components/Skeleton.test.tsx
(no output — clean)

Full-repo tsc -b and the full vitest run suite could not be used as a signal for this PR: upstream/main's App.tsx currently has unrelated, pre-existing JSX merge damage (mismatched <ErrorBoundary>/</RouteErrorBoundary> tags and a duplicated route element block, apparently from the per-route error boundary work) that fails the build regardless of this diff. Scoped typecheck/lint/test runs against only the changed files are clean, as shown above.

Notes for Reviewers

  • I did not fabricate a "performance improvement metrics" number. Skeleton screens are a perceived-performance/CLS improvement, not something a code diff can honestly quantify without a Lighthouse/CLS run against a deployed build.

  • This PR's diff is intentionally small (2 files, +36) after backing out a fuller VaultComparison.tsx wiring attempt that turned out to be a dead end for the reasons above — happy to revisit wiring it in once the page has a real data source.

  • Unrelated to this PR, but worth flagging: current main fails CI independent of this diff. Confirmed on this PR's own run:

    • App.tsx fails to build outright (mismatched <ErrorBoundary>/</RouteErrorBoundary> JSX tags, a duplicated route element block) — see Testing above.
    • Frontend lint + test fails with 20 pre-existing errors across files this PR never touches (VaultContext.tsx, useWalletNetwork.ts, TransactionReceipt.tsx, WalletConnectionStatus.tsx, useTransactionRetry.ts, etc.) — none in Skeleton.tsx/Skeleton.test.tsx.
    • Frontend env validation script and Dependency Vulnerability Scan also fail, both against pre-existing docs/lockfile drift unrelated to this change.

    None of these are things this diff introduced or can fix from within its scope.

Closes #1247

Dashboard and portfolio pages already have skeleton coverage (Junirezz#911).
The strategy comparison page has no real async data source to gate a
loading state on (VAULT_STRATEGIES is a local catalog, and any faked
loading delay either breaks its 20 existing synchronous tests or
violates the react-hooks/set-state-in-effect rule), so this adds the
skeleton building block only, ready to wire in once a real fetch
exists.
@solaawojobi00-bit
solaawojobi00-bit force-pushed the fix/issue-1247-loading-skeletons branch from 77c473a to 4c9fec6 Compare August 26, 2026 00:24
@drips-wave

drips-wave Bot commented Aug 26, 2026

Copy link
Copy Markdown

@solaawojobi00-bit Great news! 🎉 Based on an automated assessment of this PR, the linked Wave issue(s) no longer count against your application limits.

You can now already apply to more issues while waiting for a review of this PR. Keep up the great work! 🚀

Learn more about application limits

@solaawojobi00-bit solaawojobi00-bit changed the title Add loading skeleton for the vault strategy comparison page Add StrategyCardSkeleton component for the vault strategy comparison page Aug 26, 2026
@Junirezz
Junirezz merged commit 07d625e into Junirezz:main Aug 26, 2026
9 of 12 checks passed
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.

Implement loading skeleton screens for all major pages

2 participants