-
Notifications
You must be signed in to change notification settings - Fork 16
Open
Description
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:
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 ?
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels