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

Inheriting fluxorcomponent #51

Closed
carlblanchard opened this issue Jul 2, 2020 · 5 comments
Closed

Inheriting fluxorcomponent #51

carlblanchard opened this issue Jul 2, 2020 · 5 comments

Comments

@carlblanchard
Copy link

Loving the library, good work.
This is probably PEBKAC but if you don't ask you don't know.

My parent component 'A', currently inherits my base component 'B'. I tried updating my base component 'B' to derive from your Fluxorcomponent but sadly It seems I have to directly inherit your Fluxorcomponent in my main component 'A', otherwise, nothing refreshes when the state changes. Why is this?

Do you have any examples of implementing when I can't inherit your FluxorComponent.

@mrpmorris
Copy link
Owner

You can get notifications using this event https://github.com/mrpmorris/Fluxor/blob/master/Source/Fluxor/IState.cs#L31

But don't forget to implement IDisposable and remove your subscription.

If any class in the hierarchy is FluxorComponent then it should all work automatically. If it isn't, can you provide me with an example app?

@mrpmorris
Copy link
Owner

I'll close this for now. Let me know if the problem isn't resolved and I'll reopen it.

@dingdonglars
Copy link

I am just getting my feet wet with Fluxor and I find it indeed very intuitive and accessible! Thx!

Just fell over this issue since my Fluxor component did not update either. This was my fault because I had implemented an override of OnInitialized() and forgot to call up to base.OnInitialized(). Thus the subscription to state changes in the OnInitialized() method in FluxorComponent base class was never done.

Maybe @carlblanchard had the same issue?

@mrpmorris
Copy link
Owner

Could be. It wouldn't be the first time. This is why I always call the base, even if I know it does nothing :)

@carlblanchard
Copy link
Author

For me, it turned out that Blazor was erroring before hitting my dispatcher.

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

3 participants