Skip to content

Fixed hook order crash when reduced motion or empty data is active - #1

Open
rahulKarnati181 wants to merge 1 commit into
DhananjayBhosale:mainfrom
rahulKarnati181:main
Open

Fixed hook order crash when reduced motion or empty data is active#1
rahulKarnati181 wants to merge 1 commit into
DhananjayBhosale:mainfrom
rahulKarnati181:main

Conversation

@rahulKarnati181

Copy link
Copy Markdown

Problem
The app crashed with “Rendered fewer hooks than expected” when certain slides activated.
This happened because some background components returned early before calling hooks,
causing hook order mismatches between renders.

Solution

  • Ensured hooks are always called unconditionally
  • Moved early returns to after hooks
  • useMemo now safely returns empty arrays when reduced motion is enabled
  • Prevented modulo by zero when emojis array is empty

Result

  • No hook order mismatch
  • No blank screen when navigating between slides

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