Use React Router Link in MenuLink

This commit is contained in:
Justin 2022-03-22 08:28:18 -04:00
parent 526afe6779
commit 12ed6889a4
2 changed files with 2 additions and 1 deletions

View file

@ -2,6 +2,7 @@ import throttle from 'lodash/throttle';
import React from 'react'; import React from 'react';
import { defineMessages, useIntl } from 'react-intl'; import { defineMessages, useIntl } from 'react-intl';
import { useDispatch } from 'react-redux'; import { useDispatch } from 'react-redux';
import { Link } from 'react-router-dom';
import { logOut, switchAccount } from 'soapbox/actions/auth'; import { logOut, switchAccount } from 'soapbox/actions/auth';
import { fetchOwnAccounts } from 'soapbox/actions/auth'; import { fetchOwnAccounts } from 'soapbox/actions/auth';
@ -115,7 +116,7 @@ const ProfileDropdown: React.FC<IProfileDropdown> = ({ account, children }) => {
return <MenuDivider key={idx} />; return <MenuDivider key={idx} />;
} else { } else {
const Comp: any = menuItem.action ? MenuItem : MenuLink; const Comp: any = menuItem.action ? MenuItem : MenuLink;
const itemProps = menuItem.action ? { onSelect: menuItem.action } : { href: menuItem.to }; const itemProps = menuItem.action ? { onSelect: menuItem.action } : { to: menuItem.to, as: Link };
return ( return (
<Comp key={idx} {...itemProps}> <Comp key={idx} {...itemProps}>