You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I have a loader at the end of the page.
When the user scrolls to to the end of the page, I want the loader to no more observe untill new data is loaded.
And observe again once new data loaded.
Here is my code:
public async Task SetupObserver()
{
endOfListObserver = await ObserverService.Create(async (entries) => {
IsIntersecting = entries.FirstOrDefault().IsIntersecting;
Console.WriteLine("IsIntersecting...");
if (!IsLoading)
{
if (IsIntersecting)
{
await endOfListObserver.Unobserve(LoaderElement);
Console.WriteLine("unobserve");
var canAddMore = await LoadData();
StateHasChanged();
if (canAddMore)
{
await endOfListObserver.Observe(LoaderElement);
Console.WriteLine("observe");
}
}
}
});
await endOfListObserver.Observe(LoaderElement);
}
html code is just
<span @ref="LoaderElement">Please wait</span>
But an error is throwned when trying to unobserve :
Microsoft.JSInterop.JSException : 'An exception occurred executing JS interop: The JSON value could not be converted to System.Boolean. Path: $ | LineNumber: 0 | BytePositionInLine: 4.. See InnerException for more details.'
InvalidOperationException : Cannot get the value of a token type 'Null' as a boolean.
Any idea ?
The text was updated successfully, but these errors were encountered:
EnjoyMachine
changed the title
using ObserverService throws an execption
using ObserverService throws an exception
Jun 26, 2023
Dealing with this issue as well. Same error when trying to Unobserve. Using .NET 7 Blazor WASM. Running the basic example below is causing the error for me. Calling the below code AfterRender when FirstRender is true. Can confirm that the element exist as just observing the element works fine. Only Unobserve causes issues.
Hi
I have a loader at the end of the page.
When the user scrolls to to the end of the page, I want the loader to no more observe untill new data is loaded.
And observe again once new data loaded.
Here is my code:
html code is just
But an error is throwned when trying to unobserve :
Microsoft.JSInterop.JSException : 'An exception occurred executing JS interop: The JSON value could not be converted to System.Boolean. Path: $ | LineNumber: 0 | BytePositionInLine: 4.. See InnerException for more details.'
InvalidOperationException : Cannot get the value of a token type 'Null' as a boolean.
Any idea ?
The text was updated successfully, but these errors were encountered: