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

Feature: provide a way to supply IStateChangedNotifier to FluxorComponent #340

Closed
johnbaro opened this issue Aug 11, 2022 · 6 comments
Closed

Comments

@johnbaro
Copy link

I want to encapsulate all state into a Facade, including IState.

This is not possible with FluxorComponent as relies on an IStateChangedNotifier member to be present.

Would it be accepted if I opened a PR to support the following which would be integrated into the collection of states

protected IEnumerable<IStateChangedNotifier> States { get; }
@mrpmorris
Copy link
Owner

Components should only subscribe to parts of state they are interested in, not everything.

@johnbaro
Copy link
Author

I misspoke sorry, I meant that I want to encapsulate all relevant state for a single entity (Todo) into a facade.
So the interface might look like:

public interface ITodoFacade
{
    void Load();    
    Todo Get(string id);
    IState<TodoState> State { get; }
    // etc..
}

@mrpmorris
Copy link
Owner

Can't you also implement IStateChangedNotifier on that and FluxorComponent will pick it up?

@johnbaro
Copy link
Author

Yes, for some reason when I looked at the code it looked like a more complex interface.
Closing this I guess.
Thanks.

@mrpmorris
Copy link
Owner

Just to be clear.

I think if you descend your interface from IStateChangedNotifier, then FluxorComponent/FluxorLayout will detect it when it scans for injected properties and will automatically re-render when it triggers its event.

@johnbaro
Copy link
Author

johnbaro commented Aug 16, 2022 via email

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

2 participants