mirror of
https://github.com/MindWorkAI/AI-Studio.git
synced 2026-08-11 20:32:11 +00:00
29 lines
753 B
C#
29 lines
753 B
C#
namespace AIStudio.Tools.Services;
|
|
|
|
/// <summary>
|
|
/// Coordinates UI recovery after the Blazor circuit reconnects.
|
|
/// </summary>
|
|
public sealed class ReconnectRecoveryService
|
|
{
|
|
private int generation;
|
|
|
|
/// <summary>
|
|
/// Raised when the reconnect recovery generation changes.
|
|
/// </summary>
|
|
public event Action? Changed;
|
|
|
|
/// <summary>
|
|
/// Gets the current reconnect recovery generation.
|
|
/// </summary>
|
|
public int Generation => Volatile.Read(ref this.generation);
|
|
|
|
/// <summary>
|
|
/// Marks reconnect recovery as completed and requests a route subtree remount.
|
|
/// </summary>
|
|
public void NotifyRecovered()
|
|
{
|
|
Interlocked.Increment(ref this.generation);
|
|
this.Changed?.Invoke();
|
|
}
|
|
}
|