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

[Form] Unexpected interaction between storeMixin and referenceMixin #1404

Closed
rodolpheV opened this issue Jun 27, 2017 · 2 comments
Closed

[Form] Unexpected interaction between storeMixin and referenceMixin #1404

rodolpheV opened this issue Jun 27, 2017 · 2 comments

Comments

@rodolpheV
Copy link
Contributor

Unexpected behaviour

I have a main form which need the reference list 'countryList'.
If the 'countryList' reference is reloaded, this form does a this.setState(this._getStateFromStores()).
Problem: If I am editing an item with this main form, and if another view reload the 'countryList' reference, I lose my current modifications in the main form because it reload its state from the store.

Expected behaviour

I would expect the store behaviour to do a getStateFromStore only for the updated nodes of the store, not for all my listening nodes.

Versions

Focus-core: 2.1.1
Focus-components: 2.1.7-1

@Hartorn Hartorn added the Bug label Jun 27, 2017
@Hartorn Hartorn added this to the Short term release milestone Jun 27, 2017
@Hartorn
Copy link
Contributor

Hartorn commented Jun 27, 2017

@rodolpheV Indeed it is problematic. The handlers are not as precised as needed.
To avoid this problem, you can override this by using onChange on your form :
https://github.com/KleeGroup/focus-components/blob/5af5f0e8244fadee88cb733c737a7cd25d855d18/src/common/mixin/store-change-behaviour.js#L60
That way, you can decide to trigger or not the this.setState(this._getStateFromStores(), () => this._afterChange(changeInfos));

If I have time, I will come and see you today.

@Hartorn
Copy link
Contributor

Hartorn commented Nov 15, 2017

Delivered in 2.2.0

@Hartorn Hartorn closed this as completed Nov 15, 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

4 participants