fix: Zustand selector anti-pattern causing infinite re-render + plugin loader path

- Fix usePluginStore(s => s.getAll*()) selectors that returned new arrays
  on every call, causing infinite re-render loops and permanent spinner
- Affected: Sidebar, Settings, ContactDetail, ContactEditModal, PluginRouteRenderer
- Use usePluginStore(s => s.manifests) + useMemo instead
- Fix PluginRouteRenderer: show spinner instead of null when manifests loading
- Fix PluginLoader: @/ path replacement ../ -> ../../ for correct dynamic imports
This commit is contained in:
Agent Zero
2026-07-24 19:29:48 +02:00
parent 6e930b814e
commit 4b9cb5a098
6 changed files with 57 additions and 16 deletions
@@ -40,8 +40,9 @@ function getLazyComponent(componentPath: string): React.LazyExoticComponent<Reac
return componentCache.get(componentPath)!;
}
// Convert @/pages/Mail to ../pages/Mail for dynamic import
const importPath = componentPath.replace(/^@\//, '../');
// Convert @/pages/Mail to ../../pages/Mail for dynamic import
// PluginLoader.tsx is in src/components/plugins/, so ../../ resolves to src/
const importPath = componentPath.replace(/^@\//, '../../');
const LazyComp = lazy(() =>
import(/* @vite-ignore */ importPath).then((m) => ({