lyne-components icon indicating copy to clipboard operation
lyne-components copied to clipboard

[Bug]: SbbNotificationToast second call to open inconsistent

Open daniel-sc opened this issue 1 year ago • 2 comments

Preflight Checklist

Bug type

Functionality

It affects the following packages

Components

Which version of Lyne Components are you using

19.0.0-beta.4

Operating system

win11

Browser / Browser version

chrome latest

Input mode

None

Additional settings

No response

What happened?

When reusing the same sbb toast instance, open/close should behave sensible.

see reproduction below.

This is especially relevant, when building a central "toast outlet" in an application - there this issue regularly surfaces.

Steps to reproduce the issue

  1. Add sbb-toast to template:
<sbb-toast [timeout]="5000" [dismissible]="true" position="bottom-center">
  {{ (currentToast$ | async)?.message }}
</sbb-toast>
  1. add to component sbbToast = viewChild.required(SbbToast);
  2. call this.sbbToast().open();
  3. after 4 seconds call again this.sbbToast().open();
  4. observe that the toast closes after 1 second (not as expected after (another) 5 seconds)

When calling this.sbbToast().close(); immediately before "open", then the toast closes and does not open (again)!

Relevant log output


daniel-sc avatar Apr 15 '25 13:04 daniel-sc

currently a second open() call is ignored because it's already open (we check that to not mess up the state). closing it before re-opening it would be the a solution like you tried, but the event didClose has to be awaited. I think this problem will mainly be solved with a corresponding service and for now the didClose could be awaited before calling open again (or you're setting the animation duration to 0, then it's executed synchronously, but no animation visible).

jeripeierSBB avatar Apr 24 '25 13:04 jeripeierSBB

As an workaround you could handle the timeout yourself, by setting the timeout to 0 and using setTimeout in your wrapper.

jeripeierSBB avatar Apr 28 '25 10:04 jeripeierSBB

using the new overlay services should solve this problem

jeripeierSBB avatar Oct 13 '25 09:10 jeripeierSBB