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

Override properties used in connect methods from configuration #1645

Closed
MV88 opened this issue Mar 27, 2017 · 3 comments
Closed

Override properties used in connect methods from configuration #1645

MV88 opened this issue Mar 27, 2017 · 3 comments

Comments

@MV88
Copy link
Contributor

MV88 commented Mar 27, 2017

It is known that the properties used in connect method are not overridable from the config.
This can be achieved with some workaround ( set them in componentWillMount) but this is bad practice.

@MV88 MV88 changed the title Allow to override properties used in connect methods Override properties used in connect methods from configration Mar 27, 2017
@MV88 MV88 changed the title Override properties used in connect methods from configration Override properties used in connect methods from configuration Mar 27, 2017
@offtherailz
Copy link
Member

offtherailz commented Mar 27, 2017

We could set the initialState in componentWillMount or use something like "initialActions" to run on Plugins add to initialize the state (only once).
A convention should help...
Otherwise every plugin does it by itself. @mbarto what do you think. Should we schedule this for this release?

@mbarto
Copy link
Contributor

mbarto commented Mar 28, 2017

I would avoid using lifecycle methods. My idea:

  • define a connect wrapper using a custom mergeProps function
  • use the connect wrapper in plugins definition
  • the custom mergeProps will override connected props with props from the plugin cfg (instead of the opposite)

I am going to prepare a PR for this

@MV88
Copy link
Contributor Author

MV88 commented Mar 28, 2017

👍

mbarto added a commit to mbarto/MapStore2 that referenced this issue Mar 28, 2017
…nition; properties in pluginCfg override state connected properties
@mbarto mbarto closed this as completed in 0dd0fe3 Mar 28, 2017
@ghost ghost removed the pending review label Mar 28, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants