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

Element component: mark a batch group as dirty if an attribute has been changed #4289

Merged
merged 3 commits into from
May 31, 2022
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 14 additions & 0 deletions src/framework/components/element/component.js
Original file line number Diff line number Diff line change
Expand Up @@ -1654,6 +1654,12 @@ class ElementComponent extends Component {

return false;
}

_dirtyBatch() {
if (this.batchGroupId !== -1) {
this.system.app.batcher?.markGroupDirty(this.batchGroupId);
}
}
}

function _define(name) {
Expand All @@ -1668,8 +1674,16 @@ function _define(name) {
},
set: function (value) {
if (this._text) {
if (this._text[name] !== value) {
this._dirtyBatch();
Copy link
Contributor

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?

Copy link
Contributor

@mvaligursky mvaligursky May 31, 2022

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.

Copy link
Contributor

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 !

}

this._text[name] = value;
} else if (this._image) {
if (this._image[name] !== value) {
this._dirtyBatch();
}

this._image[name] = value;
}
}
Expand Down