Closed robertogonzalezdelarosa closed 1 month ago
Can you provide a minimal repro?
`@inject IDispatcher dispatcher
@inject IState<UserState> userState
<div @ref="myInput" @onkeypress="@KeyPress" @onkeydown="@KeyDown" id="myInput" tabindex="0">
<MudDialog ContentStyle="width: 400px;">
<TitleContent>
<div @onclick="SetElementFocus">
@if (userState.Value.User != null)
{
<div>@userState.Value.User.NoEmp</div>
}
</div>
</TitleContent>
<DialogContent>
<div class="badge">
<img src="assets/gafete.jpg" />
</div>
@if (userState.Value.User == null && !string.IsNullOrEmpty(userState.Value.ErrorMsg)) {
<MudAlert Severity="Severity.Error" Variant="Variant.Filled" Dense="true" Class="my-2">@userState.Value.ErrorMsg</MudAlert>
}
</DialogContent>
<DialogActions>
<MudButton OnClick="Cancel">Cancel</MudButton>
<MudButton Color="Color.Primary" OnClick="Submit">Ok</MudButton>
</DialogActions>
</MudDialog>
`</div>``
the code inside in the first @if is not updating only after I do click somewhere else in the application it updates the UI. I realize the following line
@inherits Fluxor.Blazor.Web.Components.FluxorComponent should be set at the top of the file, others modules successfully updates the UI but not in this one, it thrown an Unhadled exception occurred but only if I add the line, works great in other modules
the solution was to move in another razor component the first @if condition otherwise it throws an exception. The second @if works great without the line @inherits Fluxor.Blazor.Web.Components.FluxorComponent
If you descend from my Fluxor component it will handle subscribe/unsubscribe for you.
I recommend that approach when it is an option.
Thanks for posting your solution!
Hello, im bulding an aplication using MAUI hibrid blazor and I installed Fluxor for state management, everything works just fine but when I succesfully change the state the changes are not reflected on the UI. the rare thing is if I click random on any part of the app the changes are reflected or if I navigate to another view
Am I missing something?
hope you can help me i very frustrated at this point.
Regards