Added a rendering context which replaces the rendered flag on ignite elements so that properties won't return their value if we are rendering. This fixes an issue where lists would get messed up since they reconstruct whenever the list changes.
This commit is contained in:
@ -1,5 +1,4 @@
|
||||
import { IgniteProperty } from './ignite-html.js';
|
||||
import { IgniteElement } from './ignite-element.js';
|
||||
|
||||
class IgniteTemplate {
|
||||
constructor(items) {
|
||||
@ -468,7 +467,7 @@ class html extends IgniteTemplate {
|
||||
this.elements.forEach((item) => item.remove());
|
||||
this.elements = [];
|
||||
|
||||
//Reconstruct them html
|
||||
//Reconstruct the html
|
||||
this.construct(null, null);
|
||||
}
|
||||
}
|
||||
@ -479,10 +478,7 @@ class list extends IgniteTemplate {
|
||||
this.tagName = "shadow list";
|
||||
|
||||
if (list instanceof IgniteProperty) {
|
||||
this.callbacks.push(list.attach((oldValue, newValue) => {
|
||||
this.list = newValue;
|
||||
this.construct(null); //If the list changed, reconstruct this template.
|
||||
}));
|
||||
this.callbacks.push(list.attach((oldValue, newValue) => this.onListChanged(oldValue, newValue)));
|
||||
|
||||
this.list = list.value;
|
||||
} else {
|
||||
@ -539,6 +535,18 @@ class list extends IgniteTemplate {
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
onListChanged(oldValue, newValue) {
|
||||
this.list = newValue;
|
||||
|
||||
IgniteRenderingContext.enter();
|
||||
|
||||
try {
|
||||
this.construct(null); //The list changed, reconstruct this template.
|
||||
} catch { }
|
||||
|
||||
IgniteRenderingContext.leave();
|
||||
}
|
||||
}
|
||||
|
||||
class slot extends IgniteTemplate {
|
||||
|
Reference in New Issue
Block a user