Skip to content

Error with Toast sent from a different thread #1108

Open
@shargon

Description

@shargon

NOTE: We do not look at .zip attachments for issue investigation.

Describe the bug
Error while send a Toast from a different thread

To Reproduce
Steps to reproduce the behavior:

  1. Create a toast
<Toasts class="p-3" Messages="messages" AutoHide="true" Delay="5000" ShowCloseButton=true Placement="ToastsPlacement.TopRight" />
  1. Create messages
private List<ToastMessage> messages = new List<ToastMessage>();
  1. In a new thread (from WS client) call to
                        {
                            var msg = new ToastMessage()
                                {
                                    Type = ToastType.Danger,
                                    Title = "Issue found!",
                                    HelpText = $"{issueNewNotification.IssueSeverity} - {issueNewNotification.Date}",
                                    Message = $"{issueNewNotification.IssueTitle}.",
                                };
                            lock (messages)
                            {
                                messages.Add(msg);
                            }
                            StateHasChanged();
                        });```

**Expected behavior**
A clear and concise description of what you expected to happen.

**Screenshots**

toast.js:89 Uncaught TypeError: Cannot read properties of null (reading 'classList')
at toast.js:89:21
at g (index.js:226:51)
at HTMLDivElement.a (index.js:247:5)
at s (index.js:71:11)
at index.js:253:7


**Versions (please complete the following information):**
 - .NET Version: net9.0
 - BlazorBootstrap: 3.3.1
 - Blazor WebAssembly / Server: WebAssembly
 - Blazor Interactive Render Mode: With all the same
 - Blazor Interactivity Location: With all the same


Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions