react-hot-toast icon indicating copy to clipboard operation
react-hot-toast copied to clipboard

Clicking dismiss sometimes doesn't work for 1 second

Open philip-peterson opened this issue 2 years ago • 4 comments

Because clicking on a dismiss button triggers addToRemoveQueue, such action may take 1 second to complete which is unexpected from a UX standpoint. I'm not sure why it isn't always 1 second, sometimes it is instantaneous.

const addToRemoveQueue = (toastId: string) => {
  if (toastTimeouts.has(toastId)) {
    return;
  }

  const timeout = setTimeout(() => {
    toastTimeouts.delete(toastId);
    dispatch({
      type: ActionType.REMOVE_TOAST,
      toastId: toastId,
    });
  }, 1000);
[...]

philip-peterson avatar Mar 25 '22 20:03 philip-peterson

Bump. This is irritating.

MauriceArikoglu avatar Aug 13 '22 23:08 MauriceArikoglu

Same issue there

francois-pasquier avatar Aug 24 '22 23:08 francois-pasquier

Even I faced same issue. Temporarily replaced toast.dismiss(id) with toast.remove(id).

bilalbhojani24 avatar Jan 20 '23 07:01 bilalbhojani24

I have the same delay after toast.dismiss(id) in toast.custom

msalahz avatar May 31 '23 15:05 msalahz