-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
Element component: mark a batch group as dirty if an attribute has been changed #4289
Element component: mark a batch group as dirty if an attribute has been changed #4289
Conversation
Looks great! I'd probably add a function like this to the class
and then use this
it would allow us to call _dirtyBatch from multiple places. |
@mvaligursky Done |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
looks like a great change to me!
@@ -1667,10 +1673,12 @@ function _define(name) { | |||
return null; | |||
}, | |||
set: function (value) { | |||
if (this._text) { | |||
if (this._text && this._text[name] !== value) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't think it is safe to add this value check before setting the property. There are many setters in both text
and image
that do specific code depending if the values differ or not, so adding this here will probably break those functionalities.
I think it is best to add the value check difference only to the call to _dirtyBatch
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done: a09bb29
@@ -1668,8 +1674,16 @@ function _define(name) { | |||
}, | |||
set: function (value) { | |||
if (this._text) { | |||
if (this._text[name] !== value) { | |||
this._dirtyBatch(); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Shouldn't the callback for dirtifying be after the value is changed?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
it does not matter, this just marks it dirty .. the actual value is not used in this function.
And the batch rebuilds after all scripts are done executing.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh ok! All good, then. Thanks, @querielo !
Fixes #2579
MR makes batch group dirty if an element has been changed. So, a user don't have to mark a batch group as dirty manually, because it is error-prone.
I confirm I have read the contributing guidelines and signed the Contributor License Agreement.