Skip to content

Bug: Toast re-renders on mouse enter/leave events #401

Open
@srbh777

Description

@srbh777

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:

  1. The toast component re-renders on every mouse enter/leave event
  2. This behavior occurs even on default toasts without any custom configuration
  3. The re-rendering happens regardless of the pauseOnHover setting

Expected Behavior

  1. Toast components should only re-render when their actual content or visibility state changes

Reproduction Steps

  1. Create a basic toast notification:
toast.success('Test notification');
  1. Move your cursor in and out of the toast multiple times
  2. 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

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions