mirror of
https://github.com/glitch-soc/mastodon.git
synced 2026-03-29 03:00:33 +02:00
Fix local collection link resulting in error page (#38038)
This commit is contained in:
@@ -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();
|
||||
|
||||
@@ -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}`;
|
||||
|
||||
Reference in New Issue
Block a user