mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-06 07:40:44 +00:00
fix(ui): defer showModal until dialog is connected to DOM
This commit is contained in:
committed by
Peter Steinberger
parent
d6900ee500
commit
e8227fd7b3
@@ -100,6 +100,8 @@ describe("renderSkills", () => {
|
||||
|
||||
it("opens detail dialogs and routes ClawHub actions", async () => {
|
||||
const container = document.createElement("div");
|
||||
document.body.append(container);
|
||||
dialogRestores.push(() => container.remove());
|
||||
const onDetailClose = vi.fn();
|
||||
const showModal = vi.fn(function (this: HTMLDialogElement) {
|
||||
this.setAttribute("open", "");
|
||||
|
||||
@@ -28,7 +28,15 @@ function showDialogWhenClosed(el?: Element) {
|
||||
if (!(el instanceof HTMLDialogElement) || el.open) {
|
||||
return;
|
||||
}
|
||||
el.showModal();
|
||||
if (el.isConnected) {
|
||||
el.showModal();
|
||||
} else {
|
||||
queueMicrotask(() => {
|
||||
if (el.isConnected && !el.open) {
|
||||
el.showModal();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
export type SkillsStatusFilter = "all" | "ready" | "needs-setup" | "disabled";
|
||||
|
||||
Reference in New Issue
Block a user