ignore updates that don't change anything
This commit is contained in:
parent
14485b60be
commit
d56f77debe
1 changed files with 16 additions and 2 deletions
|
@ -58,11 +58,25 @@ export class Layout {
|
||||||
this._applyNewSize();
|
this._applyNewSize();
|
||||||
}
|
}
|
||||||
|
|
||||||
// [{id, count}]
|
|
||||||
update(sections, availableHeight) {
|
update(sections, availableHeight) {
|
||||||
if (Number.isFinite(availableHeight)) {
|
let heightChanged = false;
|
||||||
|
|
||||||
|
if (Number.isFinite(availableHeight) && availableHeight !== this._availableHeight) {
|
||||||
|
heightChanged = true;
|
||||||
this._availableHeight = availableHeight;
|
this._availableHeight = availableHeight;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const sectionsChanged =
|
||||||
|
sections.length !== this._sections.length ||
|
||||||
|
sections.some((a, i) => {
|
||||||
|
const b = this._sections[i];
|
||||||
|
return a.id !== b.id || a.count !== b.count;
|
||||||
|
});
|
||||||
|
|
||||||
|
if (!heightChanged && !sectionsChanged) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
this._sections = sections;
|
this._sections = sections;
|
||||||
const totalHeight = this._getAvailableHeight();
|
const totalHeight = this._getAvailableHeight();
|
||||||
this._sections.forEach((section, i) => {
|
this._sections.forEach((section, i) => {
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue