a tool for shared writing and social publishing

fix title on pub leaflets

+6 -1
+6 -1
components/utils/UpdateLeafletTitle.tsx
··· 12 12 import { useParams, useRouter, useSearchParams } from "next/navigation"; 13 13 import { focusBlock } from "src/utils/focusBlock"; 14 14 import { useIsMobile } from "src/hooks/isMobile"; 15 + import { useLeafletPublicationData } from "components/PageSWRDataProvider"; 15 16 16 17 export function UpdateLeafletTitle(props: { entityID: string }) { 18 + let { data: pubData } = useLeafletPublicationData(); 17 19 let firstPage = useEntity(props.entityID, "root/page")[0]; 18 20 let entityID = firstPage?.data.value || props.entityID; 19 21 ··· 23 25 let firstBlock = blocks[0]; 24 26 let title = usePageTitle(entityID); 25 27 useEffect(() => { 28 + if (pubData[0].title) { 29 + document.title = pubData[0].title; 30 + } 26 31 if (title) { 27 32 document.title = title; 28 33 } 29 - }, [title]); 34 + }, [title, pubData]); 30 35 let params = useSearchParams(); 31 36 let focusFirstBlock = params.get("focusFirstBlock"); 32 37 let router = useRouter();