6

I have a Lightning web component (LWC) using showToastEvent. The pester mode is not working right -- I do not see a close icon and it closes automatically in 3 seconds.

This answer says to clear the cache, but I've tried it on separate browsers and machines and it still doesn't work properly.

The close icon is displayed for dismissable but I want to use pester.

Has anyone else seen this issue? I'm using the LWC in a quick action so I've had to wrap it an aura component. Could this be the reason?

const evt = new ShowToastEvent({
    "title": "Warning",
    "message": "You must enter at least a zip code, an email or a mobile number",
    "mode": "pester",
    "variant": "warning"
});
this.dispatchEvent(evt);

enter image description here

0

2 Answers 2

7

Okay looks like documentation is a bit messed. This is what I found by trying all

  1. pester - Stays for 3 seconds, No close symbol
  2. sticky - Stays infinitely or Until you press the close button
  3. dismissable - Stays for 3 seconds, you can close it by pressing close button.
0
-1

As described in the Lightning Web Components Developer Guide:

ShowToastEvent Parameter: Mode | Type: String | Description: Determines how persistent the toast is. Valid values are:
  • dismissible—(Default) Remains visible until the user clicks the close button or 3 seconds has elapsed, whichever comes first.
  • pester—Remains visible for 3 seconds.
  • sticky—Remains visible until the user clicks the close button.
  • 5
    • There is no point to copy and paste the documentation if it is still wrong. You need to read the original post and the accepted answer. Apr 13 at 22:43
    • @DavidCheng Can you specify what exactly is wrong in the documentation? What I see is that the claim that the documentation is a bit messed is wrong - the link of the accepted answer leads to the LWC library and not to the documentation, which are two different things. Which is why I replied to your post and provided this answer.
      – DevelBase2
      Apr 14 at 9:58
    • @DavidCheng "The pester mode is not working right -- I do not see a close icon and it closes automatically in 3 seconds." This is exactly how it is supposed to work. I tested this yesterday and it works according to the documentation.
      – DevelBase2
      Apr 14 at 10:00
    • @DavidCheng And even in the LWC library it says: "pester, remains visible for 3 seconds and disappears automatically. No close button is provided". Can you explain what is the issue?
      – DevelBase2
      Apr 14 at 10:04
    • @DavidCheng I finally see what you meant :-) 4 years ago the definition of pester was different, now it has changed. You need to read what's currently in the documentation. I even quoted that in my answer so you don't need to open the documentation link. Your downvote was unnecessary as the definition of pester has changed since your question was posted, and my answer specifies the current definition with a link to the documentation. I will edit my answer so it's more understandable to know what is happening.
      – DevelBase2
      Apr 14 at 15:10

    You must log in to answer this question.

    Not the answer you're looking for? Browse other questions tagged .