mirror of
https://github.com/home-assistant/frontend.git
synced 2025-07-20 15:56:35 +00:00
Fix duplicate items in sortables (#7053)
This commit is contained in:
parent
357df2bf68
commit
1ffa87ea23
@ -539,17 +539,25 @@ class HaSidebar extends LitElement {
|
|||||||
this._hiddenPanels = [...this._hiddenPanels, panel];
|
this._hiddenPanels = [...this._hiddenPanels, panel];
|
||||||
this._renderEmptySortable = true;
|
this._renderEmptySortable = true;
|
||||||
await this.updateComplete;
|
await this.updateComplete;
|
||||||
|
const container = this.shadowRoot!.getElementById("sortable")!;
|
||||||
|
while (container.lastElementChild) {
|
||||||
|
container.removeChild(container.lastElementChild);
|
||||||
|
}
|
||||||
this._renderEmptySortable = false;
|
this._renderEmptySortable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
private async _unhidePanel(ev: Event) {
|
private async _unhidePanel(ev: Event) {
|
||||||
ev.preventDefault();
|
ev.preventDefault();
|
||||||
const panel = (ev.currentTarget as any).panel;
|
const panel = (ev.currentTarget as any).panel;
|
||||||
this._renderEmptySortable = true;
|
|
||||||
await this.updateComplete;
|
|
||||||
this._hiddenPanels = this._hiddenPanels.filter(
|
this._hiddenPanels = this._hiddenPanels.filter(
|
||||||
(hidden) => hidden !== panel
|
(hidden) => hidden !== panel
|
||||||
);
|
);
|
||||||
|
this._renderEmptySortable = true;
|
||||||
|
await this.updateComplete;
|
||||||
|
const container = this.shadowRoot!.getElementById("sortable")!;
|
||||||
|
while (container.lastElementChild) {
|
||||||
|
container.removeChild(container.lastElementChild);
|
||||||
|
}
|
||||||
this._renderEmptySortable = false;
|
this._renderEmptySortable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -123,6 +123,10 @@ export class HuiEntityEditor extends LitElement {
|
|||||||
private async _handleEntitiesChanged() {
|
private async _handleEntitiesChanged() {
|
||||||
this._renderEmptySortable = true;
|
this._renderEmptySortable = true;
|
||||||
await this.updateComplete;
|
await this.updateComplete;
|
||||||
|
const container = this.shadowRoot!.querySelector(".entities")!;
|
||||||
|
while (container.lastElementChild) {
|
||||||
|
container.removeChild(container.lastElementChild);
|
||||||
|
}
|
||||||
this._renderEmptySortable = false;
|
this._renderEmptySortable = false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user