[Glitch] Fix local collection link resulting in error page

Port d0e7692d79 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
diondiondion
2026-03-03 18:34:37 +01:00
committed by Claire
parent 3fecef0bb1
commit 0ae3733a22
2 changed files with 4 additions and 4 deletions

View File

@@ -105,8 +105,8 @@ const CollectionHeader: React.FC<{ collection: ApiCollectionJSON }> = ({
); );
}, [collection, dispatch]); }, [collection, dispatch]);
const location = useLocation<{ newCollection?: boolean }>(); const location = useLocation<{ newCollection?: boolean } | undefined>();
const wasJustCreated = location.state.newCollection; const wasJustCreated = location.state?.newCollection;
useEffect(() => { useEffect(() => {
if (wasJustCreated) { if (wasJustCreated) {
handleShare(); handleShare();

View File

@@ -40,8 +40,8 @@ export const CollectionShareModal: React.FC<{
}> = ({ collection, onClose }) => { }> = ({ collection, onClose }) => {
const intl = useIntl(); const intl = useIntl();
const dispatch = useAppDispatch(); const dispatch = useAppDispatch();
const location = useLocation<{ newCollection?: boolean }>(); const location = useLocation<{ newCollection?: boolean } | undefined>();
const isNew = !!location.state.newCollection; const isNew = !!location.state?.newCollection;
const isOwnCollection = collection.account_id === me; const isOwnCollection = collection.account_id === me;
const collectionLink = `${window.location.origin}/collections/${collection.id}`; const collectionLink = `${window.location.origin}/collections/${collection.id}`;