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

[BUGFIX release] willRender is called for attributeBindings changes. #11569

Closed

Conversation

rwjblue
Copy link
Member

@rwjblue rwjblue commented Jun 27, 2015

Depending on which node-manager was used, scope.view or scope.component might be used (but not both). For attributeBindings case scope.component was not set, therefore the various hooks were not being called properly.

template: compile('{{the-top}}'),
container: container
}).create();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This test is testing components, so why is scope.component not set? Surely it goes through the ComponentNodeManager? Am I just misunderstanding the test?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that this seems somewhat fishy. It is possible that this fix is still correct, but I'd like to figure out why scope.component is not set before we decide to pull the trigger on it.

@jmurphyau
Copy link
Contributor

Does this fix #11533? I know its already fixed with another PR but this I think could have also fixed it

@rwjblue
Copy link
Member Author

rwjblue commented Jun 27, 2015

@jmurphyau - Yes, that is exactly what made me start thinking about this. Specifically, willRender/didRender should absolutely be called every time that we do a rerender.

@rwjblue rwjblue force-pushed the fix-will-render-for-attribute-bindings branch from f2d25ab to ca23fea Compare June 27, 2015 18:54
@rwjblue
Copy link
Member Author

rwjblue commented Jun 27, 2015

@tomdale - I tracked down why scope.component is not set:

  • scope.component should be set in bind-shadow-scope, but is only set when options.attrs and options.view are both present. See here
  • But for the components template, we are using our friend manualElement and are only passing view into the blockFor invocation. See here

So it isn't possible that scope.component will be set for the components own element (because we were never passing attrs in that scenario).

I have updated the code in bind-shadown-scope to set scope.component if the view is stamped with view.isComponent.

rwjblue added 2 commits July 1, 2015 00:19
Depending on which node-manager was used, `scope.view` or
`scope.component` might be used (but not both). For
`attributeBindings` case `scope.component` was not set, therefore the
various hooks were not being called properly.
Any bound properties supplied for things like `current-when` or
`activeClass` would not be properly be used.

This is due to our default of two way bindings. In the case of a bound
CP specified for `activeClass`, `this.attrs.activeClass` would not be a
string, it will be a "Mutable Object".

This commit changes to use `this.getAttr` which automatically unwraps
the mutable object.
@rwjblue rwjblue force-pushed the fix-will-render-for-attribute-bindings branch from ca23fea to 27a7d64 Compare July 1, 2015 19:37
@rwjblue rwjblue closed this Nov 21, 2015
@rwjblue rwjblue deleted the fix-will-render-for-attribute-bindings branch November 21, 2015 19:59
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

Successfully merging this pull request may close these issues.

3 participants