Use React Router Link in MenuLink
This commit is contained in:
parent
526afe6779
commit
12ed6889a4
2 changed files with 4 additions and 3 deletions
|
@ -9,6 +9,7 @@ import ImmutablePureComponent from 'react-immutable-pure-component';
|
|||
import InlineSVG from 'react-inlinesvg';
|
||||
import { defineMessages, injectIntl } from 'react-intl';
|
||||
import { connect } from 'react-redux';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { openModal } from 'soapbox/actions/modals';
|
||||
import Avatar from 'soapbox/components/avatar';
|
||||
|
@ -612,8 +613,7 @@ class Header extends ImmutablePureComponent {
|
|||
return <MenuDivider key={idx} />;
|
||||
} else {
|
||||
const Comp = menuItem.action ? MenuItem : MenuLink;
|
||||
// TODO: Add `as: Link` once React Router is upgraded.
|
||||
const itemProps = menuItem.action ? { onSelect: menuItem.action } : { to: menuItem.to, target: menuItem.newTab ? '_blank' : '_self' };
|
||||
const itemProps = menuItem.action ? { onSelect: menuItem.action } : { to: menuItem.to, as: Link, target: menuItem.newTab ? '_blank' : '_self' };
|
||||
|
||||
return (
|
||||
<Comp key={idx} {...itemProps} className='group'>
|
||||
|
|
|
@ -2,6 +2,7 @@ import throttle from 'lodash/throttle';
|
|||
import React from 'react';
|
||||
import { defineMessages, useIntl } from 'react-intl';
|
||||
import { useDispatch } from 'react-redux';
|
||||
import { Link } from 'react-router-dom';
|
||||
|
||||
import { logOut, switchAccount } 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} />;
|
||||
} else {
|
||||
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 (
|
||||
<Comp key={idx} {...itemProps}>
|
||||
|
|
Loading…
Reference in a new issue