Skip to content

Conversation

@DayuanJiang
Copy link
Owner

Problem

  • Chat messages appeared after the panel on page refresh (noticeable delay)
  • Panel slide-in animation played on every page refresh, causing unwanted visual shift

Solution

  • Use useLayoutEffect instead of useEffect for localStorage restore - runs synchronously before browser paint
  • Track visibility state changes to only animate panel when user toggles it, not on page load
  • Use cn() utility for cleaner conditional className

- Use useLayoutEffect for localStorage restore (runs before paint)
- Track visibility changes to only animate panel when toggling, not on page load
- Use cn() utility for cleaner conditional className
@DayuanJiang DayuanJiang merged commit ada0626 into main Jan 1, 2026
4 of 5 checks passed
@DayuanJiang DayuanJiang deleted the fix/chat-panel-animation-and-restore-speed branch January 1, 2026 07:25
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.

2 participants