perf: skip state mutation if possible
This commit is contained in:
parent
7731dca9e7
commit
14a252db3a
|
@ -339,6 +339,9 @@ export class Entity extends decorate(Resource) {
|
|||
}
|
||||
|
||||
tickMutateState() {
|
||||
if (0 === this._traitsTypesDirty.length) {
|
||||
return;
|
||||
}
|
||||
this.state = this.state.withMutations((state) => {
|
||||
for (let i = 0; i < this._traitsTypesDirty.length; i++) {
|
||||
const type = this._traitsTypesDirty[i];
|
||||
|
|
|
@ -148,6 +148,9 @@ export class EntityList extends decorate(class {}) {
|
|||
}
|
||||
|
||||
tickMutateState(state) {
|
||||
if (0 === this._dirtyEntities.length) {
|
||||
return;
|
||||
}
|
||||
this.state = this.state.withMutations((state) => {
|
||||
for (let i = 0; i < this._dirtyEntities.length; i++) {
|
||||
const entity = this._dirtyEntities[i];
|
||||
|
|
Loading…
Reference in New Issue
Block a user