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:
@@ -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) => ({
|
||||
|
||||
Reference in New Issue
Block a user