feat: grid skeletons on the author and collection detail pages
Both loaders now stream their manga grid instead of blocking on it: the cheap header renders immediately (and still handles 404/401 in the loader) while a MangaGridSkeleton stands in until the grid resolves, then swaps in without a layout shift. Collection detail seeds its optimistic-removal state from the stream via a guarded effect. Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -10,18 +10,11 @@ import type { PageLoad } from './$types';
|
||||
export const ssr = false;
|
||||
|
||||
export const load: PageLoad = async ({ params, url }) => {
|
||||
let collection;
|
||||
try {
|
||||
const [collection, mangas, pages] = await Promise.all([
|
||||
getCollection(params.id),
|
||||
listCollectionMangas(params.id, { limit: 200 }),
|
||||
listCollectionPages(params.id, { limit: 200 })
|
||||
]);
|
||||
return {
|
||||
collection,
|
||||
mangas: mangas.items,
|
||||
total: mangas.page.total,
|
||||
pages: pages.items
|
||||
};
|
||||
// Awaited so the header renders immediately and 401/404 are handled by
|
||||
// the framework (redirect / not-found) rather than the happy path.
|
||||
collection = await getCollection(params.id);
|
||||
} catch (e) {
|
||||
if (e instanceof ApiError) {
|
||||
if (e.status === 401) {
|
||||
@@ -34,4 +27,13 @@ export const load: PageLoad = async ({ params, url }) => {
|
||||
}
|
||||
throw e;
|
||||
}
|
||||
return {
|
||||
collection,
|
||||
// Streamed so the manga/page grids show a skeleton while they load
|
||||
// instead of the whole page blocking on them.
|
||||
content: Promise.all([
|
||||
listCollectionMangas(params.id, { limit: 200 }),
|
||||
listCollectionPages(params.id, { limit: 200 })
|
||||
]).then(([mangas, pages]) => ({ mangas: mangas.items, pages: pages.items }))
|
||||
};
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user