Skip to content

perf: prevent page rerenders on theme changes - #136

Closed
rrealmrezarajabi wants to merge 2 commits into
LintError:mainfrom
rrealmrezarajabi:perf/87-prevent-theme-rerenders
Closed

rrealmrezarajabi wants to merge 2 commits into
LintError:mainfrom
rrealmrezarajabi:perf/87-prevent-theme-rerenders

Conversation

@rrealmrezarajabi

@rrealmrezarajabi rrealmrezarajabi commented Oct 13, 2026 •

Copy link
Copy Markdown

Closes #87

Summary

  • isolate theme context consumption to small theme controls
  • move theme-dependent page colors to CSS variables
  • prevent Home and page sections from rerendering on theme changes
  • memoize the theme context value and callbacks
  • remove the global transition applied to every element
  • fix the Stellar wallet server/client hydration mismatch
  • remove the redundant wallet Suspense boundary

Why

Previously, page.tsx consumed ThemeContext directly. Every theme or
custom-color update therefore rerendered the entire page.

The wallet section also checked typeof window during render, causing the
server and client to produce different initial markup.

Verification

  • React DevTools Profiler confirms that Home no longer rerenders when changing themes
  • theme colors update through the document class and CSS variables
  • no hydration errors after reloading the page
  • npm test — 16 tests passed
  • npm run lint — passed
  • npx tsc --noEmit — passed
  • npm run build — passed

@rrealmrezarajabi rrealmrezarajabi closed this by deleting the head repository Nov 2, 2026
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.

Prevent full page re-render on theme toggle

1 participant