Closed handcraftedsource closed 2 years ago
OnInitializedAsync is being executed multiple times on the same object instance?
I have a small example here that can be used to reproduce the behavior. Just start the application and switch to the counter page.
https://github.com/handcraftedsource/selector-exception-sample
Another thing I noticed: it seems like I can't use IStateSelection alone, the component needs to have IState injected as well.
AddScoped should have been AddTransient. https://github.com/mrpmorris/Fluxor/blob/252/PM-CanOnlyHaveOneStateSelectorPerComponent/Source/Fluxor/DependencyInjection/ServiceCollectionExtensions.cs#L46
I have added some other new things in there too, but need to write some unit tests when I am not busy. https://github.com/mrpmorris/Fluxor/blob/252/PM-CanOnlyHaveOneStateSelectorPerComponent/Docs/releases.md
Could you try 5.1.0-Beta1 and let me know if it solves your problem?
Yes the problem seems to be fixed with this version. Thanks for the quick fix. 👍
I used the new feature
IStateSelector<TState, TValue>
.I have called
Select
inOnInitializedAsync
of the Component on the injected property. The component is instantiated multiple times. If I switch from the first to the second component, I get an exception.Is there any way to determine if selector is already set?