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]);
const location = useLocation<{ newCollection?: boolean }>();
const wasJustCreated = location.state.newCollection;
const location = useLocation<{ newCollection?: boolean } | undefined>();
const wasJustCreated = location.state?.newCollection;
useEffect(() => {
if (wasJustCreated) {
handleShare();

View File

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