mirror of
https://github.com/usenocturne/nocturne-ui.git
synced 2026-04-25 07:45:52 +03:00
[PR #98] [MERGED] Prevent global rerender while gradient is changing #119
Labels
No labels
help wanted
pull-request
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference
starred/nocturne-ui#119
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
📋 Pull Request Information
Original PR: https://github.com/usenocturne/nocturne-ui/pull/98
Author: @alvvaro
Created: 4/24/2025
Status: ✅ Merged
Merged: 4/25/2025
Merged by: @brandonsaldan
Base:
main← Head:alvvaro/fix-gradient-rerenders📝 Commits (7)
7cbb946rename useGradientState to useGradientTransitionc8c9585Create useGradientState.js5c9d0d2Create GradientBackground.jsx30113d7implement GradientBackground and useGradientState013264cfix GradientBackground import57fcbbdmemoize useGradientStatec0aefd7add className prop to GradientBackground📊 Changes
9 files changed (+586 additions, -604 deletions)
View changed files
📝
src/App.jsx(+3 -20)📝
src/components/auth/AuthScreen.jsx(+3 -20)📝
src/components/auth/NetworkScreen.jsx(+3 -20)📝
src/components/auth/PairingScreen.jsx(+3 -20)➕
src/components/common/GradientBackground.jsx(+41 -0)📝
src/components/tutorial/Tutorial.jsx(+3 -20)📝
src/hooks/useGradientState.js(+20 -503)➕
src/hooks/useGradientTransition.js(+509 -0)📝
src/pages/Home.jsx(+1 -1)📄 Description
This PR splits
useGradientStateinto two hooks,useGradientStateanduseGradientTransition, and creates a new component,GradientBackground. The goal is to prevent the whole app tree from rerendering while the background gradient changes.The first hook's signature is similar to
useState's, returning a tuple of[gradientState, setGradientState]. The former is passed toGradientBackground, and the latter is a drop-in replacement toupdateGradientColors.useGradientTransitionis the previously existing hook, just renamed. This time it is only consumed insideGradientBackground.GradientBackgroundis a leaf component, so the transition is localized there and its rerenders don't affect the rest of the app.Before:

After:

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.