Unplanned
Last Updated: 13 Mar 2023 23:47 by William
Currently, when the Animation Container is hidden, its content is lost. The content area is detached from the DOM and re-initialized when the component is shown again.
Unplanned
Last Updated: 07 Jul 2022 08:43 by Brian
Created by: Brian
Comments: 0
Category: AnimationContainer
Type: Bug Report
3

I use an AnimationContainer to create a notification popup. It animates on the way in, pauses for a few seconds, and then animates back out. If I navigate to another page during the delay, it looks like .HideAsync() still gets called and it causes an error.

Error: System.ObjectDisposedException: Cannot access a disposed object.
Object name: 'DotNetObjectReference`1'.

Here is a test page. The yellow code causes the issue. The green code is the workaround.

@implements IDisposable

<TelerikButton OnClick="@ToggleContainer">Toggle Animation Container</TelerikButton>

<NavLink href="/">Go to Home page</NavLink>

<TelerikAnimationContainer @ref="AnimContainer" Top="50px" Left="50px" Width="250px" Height="150px"
                           AnimationType="AnimationType.ZoomOut" Class="k-popup">
    AnimationContainer
</TelerikAnimationContainer>

@code {
    TelerikAnimationContainer AnimContainer { get; set; }

    async Task ToggleContainer()
    {
        await AnimContainer.ShowAsync();

        await Task.Delay(3000);

        //if (AnimContainer != null)
        //{
            await AnimContainer.HideAsync();
        //}
    }

    void IDisposable.Dispose()
    {
        AnimContainer = null;
    }
}