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

All component parameters Observers triggered when only one changes. #11920

Closed
mandelcode opened this issue Jul 29, 2015 · 2 comments
Closed

All component parameters Observers triggered when only one changes. #11920

mandelcode opened this issue Jul 29, 2015 · 2 comments

Comments

@mandelcode
Copy link

I have this setup:

{{component-1 param1=param1 sharedParam=sharedParam}}
{{component-2 param2=param2 sharedParam=sharedParam}}

And I log all changes inside my components like this:

onParam1Change: function() {
    log("param 1 has changed inside component 1");
}.observes("param1"),

Here's what I get when I change param1:

param 1 has changed inside component 1
shared param has changed inside component 1
shared param has changed inside component 1
will render component 1

... and sharedParam:

shared param has changed inside component 1
will render component 1
param 2 has changed inside component 2
shared param has changed inside component 2
param 2 has changed inside component 2
shared param has changed inside component 2
will render component 2

See this fiddle: https://jsfiddle.net/4bwsqcx1/8/

There are small differences depending on who updated the value (the parent view or one of the components).

This may causes logic issues, performances issues (when a parameter is updated often), and in the worst case infinite loops (for example if a parameter change triggers an ajax request which in turn modifies another parameter).

@jcope2013
Copy link
Contributor

related #11491

@stefanpenner
Copy link
Member

Ya this is a duplicate

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