Open
Description
Bug: Toast re-renders on mouse enter/leave events
Description
Toast notifications in react-hot-toast re-render unnecessarily when the cursor moves in and out of the toast component, This causes performance issues and potentially disrupts animations or UI interactions.
Current Behavior
When moving the cursor in and out of any toast notification:
- The toast component re-renders on every mouse enter/leave event
- This behavior occurs even on default toasts without any custom configuration
- The re-rendering happens regardless of the
pauseOnHover
setting
Expected Behavior
- Toast components should only re-render when their actual content or visibility state changes
Reproduction Steps
- Create a basic toast notification:
toast.success('Test notification');
- Move your cursor in and out of the toast multiple times
- Observe that the toast re-renders on each mouse movement (visible in React DevTools or through performance monitoring)
Environment
- react-hot-toast version: 2.4.0
- React version: [your React version]
- Browser: [Chrome/Firefox/Safari/etc.]
- OS: [Windows/Mac/Linux]
Metadata
Metadata
Assignees
Labels
No labels