fix: split app into (main)/(sandbox) route groups so plugin iframe hydrates properly

This commit is contained in:
Linus Rath
2026-05-20 23:41:49 +02:00
parent d45c8ef511
commit 628966d3b5
57 changed files with 109 additions and 37 deletions
+8 -4
View File
@@ -262,11 +262,11 @@ export const usePluginStore = create<PluginStoreState>()(
// Sync server-managed plugins before loading
await syncServerPlugins(get, set);
// Load all enabled plugins
// Load all enabled plugins in parallel. Sequential `await` made one
// hung/slow plugin block every subsequent one; loadSandboxedPlugin
// catches its own errors so allSettled is just for tidy completion.
const enabledPlugins = get().plugins.filter(p => p.enabled && p.status !== 'error');
for (const plugin of enabledPlugins) {
await loadPlugin(plugin);
}
await Promise.allSettled(enabledPlugins.map(plugin => loadPlugin(plugin)));
set({ initialized: true });
})();
@@ -474,6 +474,9 @@ async function syncServerPlugins(
),
}));
} else if (local.managed !== true || local.forceEnabled !== sp.forceEnabled) {
// When forceEnabled flips on, enable the plugin in the same pass so
// the user doesn't need a second refresh for it to run.
const shouldAutoEnable = sp.forceEnabled && !local.enabled;
set(state => ({
plugins: state.plugins.map(p =>
p.id === sp.id
@@ -482,6 +485,7 @@ async function syncServerPlugins(
managed: true,
forceEnabled: sp.forceEnabled,
settingsSchema: sp.settingsSchema,
...(shouldAutoEnable ? { enabled: true, status: 'enabled' as const } : {}),
}
: p
),