Merge branch 'master' into 14603-add-controlled-vocabulary-to-advanced-search
[arvados-workbench2.git] / src / views-components / main-app-bar / account-menu.tsx
index 1609aafa0849a277432f343dbe39e788de788bf7..53a5753d0c2130380ce900efa2c1f6f73b33698d 100644 (file)
@@ -11,25 +11,28 @@ import { DispatchProp, connect } from 'react-redux';
 import { logout } from '~/store/auth/auth-action';
 import { RootState } from "~/store/store";
 import { openCurrentTokenDialog } from '~/store/current-token-dialog/current-token-dialog-actions';
-import { openRepositoriesPanel } from "~/store/repositories/repositories-actions";
 import { navigateToSshKeysUser, navigateToMyAccount } from '~/store/navigation/navigation-action';
 import { openUserVirtualMachines } from "~/store/virtual-machines/virtual-machines-actions";
+import { openRepositoriesPanel } from '~/store/repositories/repositories-actions';
 
 interface AccountMenuProps {
     user?: User;
+    currentRoute: string;
 }
 
 const mapStateToProps = (state: RootState): AccountMenuProps => ({
-    user: state.auth.user
+    user: state.auth.user,
+    currentRoute: state.router.location ? state.router.location.pathname : ''
 });
 
 export const AccountMenu = connect(mapStateToProps)(
-    ({ user, dispatch }: AccountMenuProps & DispatchProp<any>) =>
+    ({ user, dispatch, currentRoute }: AccountMenuProps & DispatchProp<any>) =>
         user
             ? <DropdownMenu
                 icon={<UserPanelIcon />}
                 id="account-menu"
-                title="Account Management">
+                title="Account Management"
+                key={currentRoute}>
                 <MenuItem>
                     {getUserFullname(user)}
                 </MenuItem>