Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Modifying the application Store from the background #73

Open
gtejeda opened this issue Feb 1, 2023 · 0 comments
Open

Modifying the application Store from the background #73

gtejeda opened this issue Feb 1, 2023 · 0 comments

Comments

@gtejeda
Copy link

gtejeda commented Feb 1, 2023

Greetings, I'm trying to modify my application store class starting from a PeriodicTimer in Blazor, then I call a service which makes the httpcalls and updates the store class (both the Synchronize method and the AppStore method that receives the new value in the state class are marked with the Action), however, the UI is not being updated.

My blazor component has the Observer attribute in place

[Action]
    async Task HandleTimerAsync(PeriodicTimer timer, CancellationToken cancel = default)
    {
        try
        {
            while (await timer.WaitForNextTickAsync(cancel))
            {
                await synchronizer. Synchronize();
                await InvokeAsync(() => StateHasChanged());
            }
        }
        catch (Exception)
        {
            //Handle the exception but don't propagate it
        }
    }

Has anybody done something like this on a backgroundservice or timer?
Thanks in advance,
Geo

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant