i have a blazor app for factory layout and i want to make the functionality of reloading every 15 seconds but it doesn’t work

i’ve tried PeriodicTimer and jsinterop but both doesn’t achieve the desired behaviour

here’s my @code block that outputs no errors, exception nor the expected bahaviour

@code {
public List<Station> Stations = new List<Station>();
private List<Connection> Connections = new List<Connection>();
private List<CurvedConnection> CurvedConnections = new List<CurvedConnection>();
private List<string> LineElements = new List<string>();
private PeriodicTimer periodicTimer;
private CancellationTokenSource _cts = new CancellationTokenSource();
private DateTime currentTime = DateTime.Now;
private bool isInitialized = false;


protected override void OnInitialized()
{
    SetupInitialStations();
    UpdateConnections();
}

protected override async Task OnAfterRenderAsync(bool firstRender)
{
    if (firstRender)
    {
        isInitialized = true;
        periodicTimer = new PeriodicTimer(TimeSpan.FromSeconds(15));

        while (await periodicTimer.WaitForNextTickAsync(_cts.Token))
        {
            await JS.InvokeVoidAsync("reloadPage");
            await JS.InvokeVoidAsync("console.log", "Periodic work done", currentTime);
        }
    }

public void Dispose()
{
    _cts.Cancel();
    periodicTimer?.Dispose();
}}