fix: reconcile native styles when layout effects reconnect - #690
Conversation
|
Navigate logical layers of code changes, visualize relationships, and explore their blast radius. No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: defaults Review profile: CHILL Plan: Advanced Run ID: 📒 Files selected for processing (2)
Included review availability: Your plan provides up to 4 included reviews per hour; 3 remain after this review. 📝 WalkthroughWalkthroughThe native ChangesNative style reconnection
Priority: ➖ Normal Estimated code review effort: 2 (Simple) | ~10 minutes Change: Bug fix · Severity of issue fixed: Medium Merge Risk: ⚪ Minimal · up to The native style reconnection fix is mergeable after normal checks; no actionable risk is established. 🚥 Pre-merge checks | ✅ 5✅ Passed checks (5 passed)
✨ Finishing Touches🧪 Generate unit tests (beta)
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. Comment |
|
|
Thanks for contribution! |
Summary
Native
useStylesubscribers now catch dependency updates missed while their layout effects were disconnected. Memoized content revealed byActivityor Suspense keeps its state and immediately resolves the current styles.Fixes #689.
Reproduction: https://github.com/eliotgevers/uniwind-activity-reproduction
Why
React can recreate layout effects without rendering unchanged children. Subscribing again only handles future notifications. Compare the current dependency revision with the revision captured alongside the rendered styles, after registering the listener, and schedule a render if they differ.
The comparison uses a render-local value rather than mutating a ref during render. The effect retains the existing dependency-set key, so normal style updates do not cause unnecessary resubscription. No new API or dependency is introduced.
Verification
renderUniwindhelper: Activity catches theme changes in both directions and continues receiving visible updates; Suspense catches a theme change on reveal. Stable children ensure ordinary parent renders cannot mask the bug.Scope
This repairs the OSS JS style subscription boundary. It does not change the native Pro implementation, React's Activity behavior, or app lifecycle/background rendering. Hidden component effects remain disconnected. Static styles and scoped themes retain their existing dependency behavior.
Summary by CodeRabbit