Fix local collection link resulting in error page (#38038)

This commit is contained in:
diondiondion
2026-03-03 18:34:37 +01:00
committed by GitHub
parent c0b2286871
commit d0e7692d79
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}`;