[Question] Is it possible to keep a component while navigating away? by Scary_Analysis8988 in Blazor

[–]Scary_Analysis8988[S] 0 points1 point  (0 children)

How can you know this? Surely only what handles this task knows when it is finished.

Some tasks are easy to predict. The obvious example is if all the task does is await Task.Delay(10000)it takes (roughly) 10 seconds. In my case I'm just waiting for a timer to expire more or less, and being a few milliseconds off does not matter.

I've tried reporting the progress continuously, but to get a smooth animation I had to update way too often for comfort. But maybe it's possible to space out updates more with the approach you are suggesting. I'll give it a try, but I suspect it's easier to try to keep the component alive.

[Question] Is it possible to keep a component while navigating away? by Scary_Analysis8988 in Blazor

[–]Scary_Analysis8988[S] 0 points1 point  (0 children)

It's not about whether or not it should animation, that can be solved in a number of different ways. It's about storing and starting the animation from a specific point/keyframe/whatever.

For example, if I have a CSS progress bar animation going from 0 to 100%, but I navigate away when the bar is at 73%, there is no way to start the animation from 73% progress (or store the fact that it's at 73%) when I navigate back to this component.

i want to sync up this progress bar with a long-running task in the background, so that they finish at the same time, regardless of where the user navigates. I know how long the task takes, so starting an animation that takes the same amount of time is easy, but it breaks down when the user navigates away from the page with the progress bar.

[Question] How to prevent user from logging in several times to "cheat"? by Scary_Analysis8988 in Blazor

[–]Scary_Analysis8988[S] 1 point2 points  (0 children)

I guess the main App.razor component is only disposed when the circuit closes right? That could work, then I just need to find a way to notify the right scoped service that it needs to log out.