fix: keep plugins loaded after signing in from the login screen

This commit is contained in:
LukeGus committed 2026-09-27 00:38:06 -05:00
1 parent 8043d6dbdd
commit 4423c4c8ef
3 files changed
+48 -12

No files matched your search

+38
View File
@@ -7,6 +7,8 @@ import {
isPluginFrontendActive,
orderForActivation,
resetPluginLoader,
startPluginRuntime,
startPreLoginPlugins,
syncPlugins,
} from "@/plugin-host/loader";
import {
@@ -208,6 +210,42 @@ describe("plugin loader", () => {
expect(railIds()).not.toContain("headless-panel");
});
it("keeps every plugin when the pre-login list lands after sign-in", async () => {
modules.login = railPlugin("login");
modules.alpha = railPlugin("alpha");
plugins = [summary("login"), summary("alpha")];
let releasePreLogin: (value: Response) => void = () => {};
vi.spyOn(globalThis, "fetch").mockImplementation(
() =>
new Promise<Response>((resolve) => {
releasePreLogin = resolve;
}),
);
const preLogin = startPreLoginPlugins();
await startPluginRuntime();
releasePreLogin(new Response(JSON.stringify([summary("login")])));
await preLogin;
expect(isPluginFrontendActive("login")).toBe(true);
expect(isPluginFrontendActive("alpha")).toBe(true);
});
it("ignores a pre-login load started after sign-in", async () => {
modules.login = railPlugin("login");
modules.alpha = railPlugin("alpha");
plugins = [summary("login"), summary("alpha")];
vi.spyOn(globalThis, "fetch").mockImplementation(
async () => new Response(JSON.stringify([summary("login")])),
);
await startPluginRuntime();
await startPreLoginPlugins();
expect(isPluginFrontendActive("alpha")).toBe(true);
});
it("settles even when the plugin list cannot be fetched", async () => {
vi.spyOn(console, "error").mockImplementation(() => {});
configurePluginLoader({