lazy-load chapters when their page is first loaded

as opposed to before, where if we loaded either the details page or any chapter *every chapter* was loaded.
should result in a notable performance boost in the majority of situations
master
Drake 1 year ago
parent d7b64a3509
commit 9ffaf614f1

@ -12,7 +12,7 @@ import ScrollHeader from "../scripts/ScrollHeader.ts";
export default async (params: URLSearchParams) => {
if (!params.get("id")) return <FourOhFour />;
const story = await watt.getStory(params.get("id") as string);
const story = await watt.getStory(params.get("id") as string, false);
// chapters
if (params.get("chapter")) {

@ -36,9 +36,9 @@ export default (props: PropsWithChildren<StoryProps>) => {
];
chaptersInHeader = chaptersInHeader.concat(
props.story.chapters.map((ch, i) => ({
name: ch.name,
href: `/story?id=${ch.workID}&chapter=${i}`
props.story.storyJSON.parts.map((ch, i) => ({
name: ch.title,
href: `/story?id=${props.story.id}&chapter=${i}`
}))
);

Loading…
Cancel
Save