chanan / BlazorStrap

Bootstrap 4 Components for Blazor Framework
https://blazorstrap.io
The Unlicense
911 stars 156 forks source link

Question - Dynamic Data in Tooltip? #554

Closed benhysell closed 1 year ago

benhysell commented 1 year ago

Not sure if I have a bug or I'm trying to do something I cannot do. Say I had SignalR hooked up to my page and when I receive a new message I'd like that data to be shown in my tooltip if the user hovers over the proper element. Something like:

<BSTooltip Placement="Placement.Top" Target="htmlTooltip">Last Update: @_message.TimeReceived</BSTooltip>

In my code I can confirm signalR is doing what it should be doing and new messages are received, however my @_message.TimeReceived is never updated in the tooltip.

SignalR Hub Code:

 _hub.On<Message>("SignalrRemoteMethodName", (statusMessage) =>
            {
                    _message = statusMessage;
                    StateHasChanged();
            });
jbomhold3 commented 1 year ago

Just confirmed what your doing should work, however. Your hub action might be invoking off the UI thread try InvokeAsync(StateHasChanged);

benhysell commented 1 year ago

@jbomhold3 It does work, but I'll get a single update not a continuous update on every new SignalR message.

Let me get a repo together when I have a spare moment.