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.
1
  • The documentation is not messed anymore. It's been fixed: pester, remains visible for 3 seconds and disappears automatically. No close button is provided
    – DevelBase2
    Apr 21 at 10:50
0

You are incorrect in your claim that the documentation describes pester mode in the following way:

Remains visible until the close button is clicked.

As described in the Lightning Web Components Developer Guide, Spring '24 LWC as per the date of this post:

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.
  • The above means that the behavior you are describing as faulty is an expected and in fact a correct behavior. You are not supposed to see a close icon and the toast should close automatically in 3 seconds.

    You can not use a close icon using pester mode, use dismissible mode instead.

    I suppose the technical reason is that Salesforce has made some changes in the documentation since this question has been posted.

    You should provide a link to the specific part of the documentation instead of copy pasting the content of it. You know very well that documentation evolves and the content changes, that's why it's necessary to provide a link for other users to check whether the cited content of the documentation corresponds to the actual content. Your question has become obsolete in its formulation, which is why I am posting this answer, even though there already is an accepted one.

    The link you provided to the other question is faulty in the same way as the author cited the content of documentation without providing a link.

    2
    • @DavidCheng You need to read again your question and the actual documentation before downvoting my answer.
      – DevelBase2
      Apr 21 at 10:48
    • You are right, I should have include the documentation text back then. Apr 21 at 14:41

    You must log in to answer this question.

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