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

State not changing when using custom base class #25

Closed
psampaio opened this issue Apr 29, 2020 · 6 comments · Fixed by #28
Closed

State not changing when using custom base class #25

psampaio opened this issue Apr 29, 2020 · 6 comments · Fixed by #28

Comments

@psampaio
Copy link

I have a custom base class that implements basic parameter validation and awaits for the store to initialize (MyComponent < MyBaseClass < FluxorComponent). This base class has an IState<State> property (not in MyComponent) and the components are not being refreshed.

Maybe something in the StateSubscriber, when calling GetStateDelegatesForType is not detecting properties in base classes?

@mrpmorris
Copy link
Owner

I've not been able to reproduce this. I created a structure like so

1: CounterA : FluxorComponent
2: CounterB : CounterA
3: Counter : CounterB

And the counter updated. Can you provide something that reproduces this?

@psampaio
Copy link
Author

psampaio commented May 2, 2020

I just re-tested and the root cause is that the IState property is private. If I change it to protected, it works. In my case, I keep it private and expose the relevant state properties as protected.

If this is the intended behavior, you can close this issue.

@mrpmorris
Copy link
Owner

It's not, I to use private state. I will have a look tomorrow. I'm due to do a release soon so hopefully I'll get to the bottom of this.

@mrpmorris
Copy link
Owner

Do you think you could send me a sample that reproduces this problem, please?

Thank you

@psampaio
Copy link
Author

psampaio commented May 6, 2020

Here you go:
https://github.com/psampaio/fluxorsample

See BasePage.cs in the root. Basic workflow: Page1 and Page2 have a common underlying MyDomainObject that BasePage tries to load from the route Id. The OnAfterRenderAsync override is for when you go directly to the pages, waiting for the store initialization. If Id matches on of our objects, dispatch an action to select it, which changes the state and refreshes.

@mrpmorris
Copy link
Owner

Fixed in release 3.1.1, which should be available immediately.

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

Successfully merging a pull request may close this issue.

2 participants