Closed scaljeri closed 4 years ago
@scaljeri if you have a method that creates a selector using createSelector
then you should not decorate that method with the @Selector
decorator.
This will be causing your issue
Ok, thanks, that explains it. I already noticed that the @selector
was causing the issues :)
@scaljeri @markwhitfeld Can you help with the same issue about selector but instead of using create selector I'm using @selector
My state
@Selector() static productPreviewFeatures(appConfig?: AppConfigState) { return appConfig.productPreview.requiredFields; }
something like this on the Angular Component variables
@Select(AppConfigState.productPreviewFeatures) features$: Observable
I think that we need more code, at least I do. Maybe you can fork my stackblitz and reproduce the issue?
@efelipe402 Is it possible that your selector may have an error?
(set supressErrors
to false
in the selectorOptions
in the options
passed to your forRoot
to check for this)
Or, that you are potentially mutating the objects in your state as opposed to doing immutable updates?
(turn on the developmentMode
in the forRoot
options and check for errors related to mutations)
PS. @efelipe402 probably better to ask this in a separate issue (or on slack) because this is unrelated the original issue.
Description
I've done some testing with NGXS, to be more precise with Dynamic selectors. Unfortunate it is that part that I cannot get to work. I've tried to find answers on Stackoverflow without success. Anyway, I'm new to NGXS and this issue might be just stupidness or a document issue or even a bug. Let's find out
I have also created a stackblicz to reproduce the issue What happens in this stackblitz is that
MainComponent
updates the state, andNodeComponent
should be notified of that change.My State class looks like this:
Then, in NodeComponent I listen for a specific state change
And finally, the new state is set in
MainComponent
as followsFor some reason, the static methods in my state class are never called.
🔬 Minimal Reproduction
Checkout my stackblitz
Expected vs Actual Behavior**
What I expect is, that the below code receives an object and is printed to the console
🌍 Your Environment
Angular 9.0.2 @ngxs/core 3.6.2