fix(updates): sync entry-point states after component updates

This commit is contained in:
zipg authored and GitHub committed 2026-09-20 11:03:31 +08:00
1 parent db5e6f106b
commit 6babd1bf9b
7 files changed
+86 -7

No files matched your search

@@ -0,0 +1,16 @@
// @vitest-environment happy-dom
import { describe, expect, it, vi } from "vitest";
import { COMPONENT_PLUGINS_UPDATED_EVENT, notifyComponentPluginsUpdated } from "@/lib/updates/componentUpdateEvents";
describe("component update events", () => {
it("notifies plugin surfaces after component-level plugin updates", () => {
const listener = vi.fn();
window.addEventListener(COMPONENT_PLUGINS_UPDATED_EVENT, listener);
notifyComponentPluginsUpdated();
expect(listener).toHaveBeenCalledOnce();
window.removeEventListener(COMPONENT_PLUGINS_UPDATED_EVENT, listener);
});
});
@@ -0,0 +1,5 @@
export const COMPONENT_PLUGINS_UPDATED_EVENT = "dbx:component-plugins-updated";
export function notifyComponentPluginsUpdated(): void {
window.dispatchEvent(new Event(COMPONENT_PLUGINS_UPDATED_EVENT));
}