ngneat / hot-toast

🍞 Smoking hot Notifications for Angular. Lightweight, customizable and beautiful by default.

Home Page:https://ngneat.github.io/hot-toast

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Toast Observer with optional handlers (loading, error, success)

klevisndoka opened this issue · comments

I'm submitting a...

  • Regression (a behavior that used to work and stopped working in a new release)
  • Bug report
  • Performance issue
  • Feature request
  • Documentation issue or request
  • Support request

Current behavior

Right now if I add toast observer in pipe only with loading and error handler, the loading will not disappear on success.

this.toast.observe({ loading: 'Loading...', error: (err) => err.message })

If I add also success, it will disappear immediately after result is received.

Expected behavior

If I add toast observer in pipe only with loading and/or error handler, the loading toast should disappear on success or error even if I don't put an "handler" for that.

Minimal reproduction of the problem with instructions

What is the motivation / use case for changing the behavior?

Environment

Angular version: 14.2.2

Browser:

  • Chrome (desktop) version XX
  • Chrome (Android) version XX
  • Chrome (iOS) version XX
  • Firefox version XX
  • Safari (desktop) version XX
  • Safari (iOS) version XX
  • IE version XX
  • Edge version XX

For Tooling issues:

  • Node version: 16.16.0
  • Platform: Windows

Any updates on this issue. I have the same issue on angular version 15.2.4 and @ngneat/hot-toast: 4.1.0

@NetanelBasal how should we handle this? I can think of 2 approaches:

  1. Close the toast if success/error is not provided
  2. Provide toastRef from operator and let consumer close the toast if they want