perf(library): persistent SPA shell, in-memory folder tree caching, and zero-flicker LRU thumbnail caching
This commit is contained in:
@@ -37,7 +37,6 @@ function pick(route: string) {
|
||||
);
|
||||
}
|
||||
|
||||
// Intercept internal link clicks for instant SPA transitions without full page reload
|
||||
function Shell() {
|
||||
const [route, setRoute] = useState(() => window.location.pathname + window.location.search);
|
||||
|
||||
@@ -64,7 +63,31 @@ function Shell() {
|
||||
};
|
||||
}, []);
|
||||
|
||||
return pick(route);
|
||||
const isApp = route.startsWith('/app');
|
||||
const isLibrary = route.startsWith('/library');
|
||||
const isOther = !isApp && !isLibrary;
|
||||
|
||||
return (
|
||||
<>
|
||||
<div style={{ display: isApp ? 'block' : 'none', height: '100%' }}>
|
||||
<Workspace />
|
||||
</div>
|
||||
<div style={{ display: isLibrary ? 'block' : 'none', height: '100%' }}>
|
||||
<Library />
|
||||
</div>
|
||||
{isOther ? (
|
||||
route.startsWith('/admin') ? (
|
||||
<Admin />
|
||||
) : route.startsWith('/photos') ? (
|
||||
<PhotosPage />
|
||||
) : route.startsWith('/profile') ? (
|
||||
<ProfilePage />
|
||||
) : (
|
||||
<Landing />
|
||||
)
|
||||
) : null}
|
||||
</>
|
||||
);
|
||||
}
|
||||
|
||||
const root = document.getElementById('root');
|
||||
|
||||
Reference in New Issue
Block a user