Skip to content

Commit 2e77986

Browse files
cngonzalezricokahler
authored andcommitted
fix: hard link between datasets, for now (#7228)
1 parent c4f9a1f commit 2e77986

File tree

1 file changed

+7
-16
lines changed

1 file changed

+7
-16
lines changed

packages/sanity/src/core/studio/components/navbar/workspace/WorkspaceMenuButton.tsx

+7-16
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,6 @@ import {
77
Menu,
88
Text,
99
} from '@sanity/ui'
10-
import {useRouter} from 'sanity/router'
1110
import {styled} from 'styled-components'
1211

1312
import {MenuButton, type MenuButtonProps, MenuItem, Tooltip} from '../../../../../ui-components'
@@ -21,7 +20,6 @@ const StyledMenu = styled(Menu)`
2120
max-width: 350px;
2221
min-width: 250px;
2322
`
24-
2523
const POPOVER_PROPS: MenuButtonProps['popover'] = {
2624
constrainSize: true,
2725
fallbackPlacements: ['bottom-end', 'bottom'],
@@ -30,9 +28,8 @@ const POPOVER_PROPS: MenuButtonProps['popover'] = {
3028

3129
export function WorkspaceMenuButton() {
3230
const workspaces = useWorkspaces()
33-
const {activeWorkspace, setActiveWorkspace} = useActiveWorkspace()
31+
const {activeWorkspace} = useActiveWorkspace()
3432
const [authStates] = useWorkspaceAuthStates(workspaces)
35-
const {navigateUrl} = useRouter()
3633
const {t} = useTranslation()
3734

3835
const multipleWorkspaces = workspaces.length > 1
@@ -77,24 +74,18 @@ export function WorkspaceMenuButton() {
7774
? 'logged-out'
7875
: 'no-access'
7976

80-
const handleSelectWorkspace = () => {
81-
if (state === 'logged-in' && workspace.name !== activeWorkspace.name) {
82-
setActiveWorkspace(workspace.name)
83-
}
84-
85-
// Navigate to the base path of the workspace to authenticate
86-
if (state === 'logged-out') {
87-
navigateUrl({path: workspace.basePath})
88-
}
89-
}
9077
const isSelected = workspace.name === activeWorkspace.name
78+
79+
// we have a temporary need to make a hard direct link to the workspace
80+
// because of possibly shared context between workspaces. When this is resolved,
81+
// we can remove this and use setActiveWorkspace instead
9182
return (
9283
<MenuItem
84+
as="a"
85+
href={workspace.basePath}
9386
badgeText={STATE_TITLES[state]}
9487
iconRight={isSelected ? CheckmarkIcon : undefined}
9588
key={workspace.name}
96-
// eslint-disable-next-line react/jsx-no-bind
97-
onClick={handleSelectWorkspace}
9889
pressed={isSelected}
9990
preview={<WorkspacePreviewIcon icon={workspace.icon} size="small" />}
10091
selected={isSelected}

0 commit comments

Comments
 (0)