Skip to content

refactor(landing): memoize dashboard cards, lazy-load below-fold sections, shrink logo - #615

Open
Codesmith313 wants to merge 1 commit into
kellymusk:devfrom
Codesmith313:perf/477-478-479-lazy-load-memoize-logo
Open

refactor(landing): memoize dashboard cards, lazy-load below-fold sections, shrink logo#615
Codesmith313 wants to merge 1 commit into
kellymusk:devfrom
Codesmith313:perf/477-478-479-lazy-load-memoize-logo

Conversation

@Codesmith313

Copy link
Copy Markdown

Summary

Three perf issues, all assigned to me:

  • perf: memoize expensive balance and payment list renders #479TopAssets, ActivityHighlights, and QuickConvert (the home dashboard's balance/activity sections) now wrapped in React.memo, so an unrelated state update on the home page no longer re-renders the whole dashboard. Added a test confirming each is actually memo-wrapped.
  • perf: lazy-load landing page sections to improve initial LCP #477 — The landing page's use-cases, FAQ, and footer sections are now behind next/dynamic with skeleton loading fallbacks, so they're split out of the page's initial render path instead of loading eagerly alongside the hero.
  • perf: replace PNG logos with optimised SVG/WebP using next/image #478public/logo.png (313 KB, turned out to be a fully unreferenced raw Figma export — nothing in the app links to it) re-encoded as an 800px-wide WebP at ~7.5 KB. Added sizes to the hero image next to its existing priority. There were no raw <img> tags anywhere in app/components to convert — landing already uses next/image throughout.

Closes #477
Closes #478
Closes #479

A blocking bug found along the way

components/session-provider.tsx didn't compile on dev — a bad merge between the Freighter-auth PR and the session-persistence PR left duplicate imports, a duplicate local Session type shadowing the one imported from @/lib/api, and two interleaved signOut implementations (the second literally opening inside the first's unclosed body). This is what npm test (the pre-push hook's full suite) has to be able to compile, so it needed fixing here too. Reconciled it to the cookie-based api.getSession()/api.logout() restoration path (the direction issue #582 already points toward, away from storing the JWT in localStorage) plus the Freighter sign-in flow, dropping the now-redundant local Session interface and localStorage fallback in favor of the type @/lib/api already exports.

Notes

  • next/dynamic's ssr: false isn't usable from a Server Component, so these three sections stay server-rendered — the benefit here is streaming (the hero + above-fold content isn't blocked on rendering the below-fold sections) rather than a client-JS-bundle reduction, since none of UseCases/Faq/SiteFooter ship client JS in the first place. I didn't set up a Lighthouse CI run to produce a hard LCP percentage for this environment — that needs a deployed/built target — but streaming below-fold Server Components is a standard technique for improving TTFB/LCP.
  • npm run build currently fails on dev for reasons unrelated to this PR — app/(app)/transactions/page.tsx and app/request/[id]/page.tsx both have the same "bad merge" pattern as session-provider.tsx (duplicate imports, dozens of now-undefined names), and lib/api.ts references an undefined Sep24Interactive type. None of these are touched by this PR.

Test plan

  • npx jest — 35/35 passing, including the pre-push hook's own full run
  • npx eslint on every changed file — clean
  • npx tsc --noEmit — no new errors introduced (pre-existing errors are all in files this PR doesn't touch)
  • Visually diffed logo.webp against the original logo.png — pixel-identical at 800px, well under the 10 KB target

…ions, shrink logo

- Wrap TopAssets, ActivityHighlights, and QuickConvert in React.memo so an
  unrelated home-page state update doesn't re-render the whole dashboard;
  add a test asserting each is actually memo-wrapped. (kellymusk#479)

- Lazy-load the landing page's use-cases, FAQ, and footer sections via
  next/dynamic with CSS-only skeleton fallbacks (no framer-motion, so the
  fallback itself ships no client JS), keeping the hero and above-fold
  sections in the initial bundle. (kellymusk#477)

- Re-encode the unreferenced 313 KB public/logo.png (a raw Figma export) as
  an 800px WebP at ~7.5 KB, and add `sizes` to the hero image alongside its
  existing `priority`. There were no raw <img> tags anywhere in app/components
  to convert — landing already uses next/image throughout. (kellymusk#478)

Along the way, fixed components/session-provider.tsx: a bad merge between
the Freighter-auth branch and the session-persistence branch had left
duplicate imports, a duplicate Session type, and two interleaved, broken
signOut implementations — the file didn't compile, which blocked the full
test suite (npm test is what the pre-push hook runs). Reconciled to the
cookie-session restoration path plus Freighter sign-in.

Closes kellymusk#477
Closes kellymusk#478
Closes kellymusk#479
@drips-wave

drips-wave Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Codesmith313 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

@vercel

vercel Bot commented Aug 31, 2026

Copy link
Copy Markdown

@Codesmith313 is attempting to deploy a commit to the kelly musk's projects Team on Vercel.

A member of the Team first needs to authorize it.

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