@@ -7,7 +7,7 @@ import type {
77 QuickChatShortcut ,
88} from '@sim/desktop-bridge'
99import { Label , Switch , toast } from '@sim/emcn'
10- import { useParams , useRouter } from 'next/navigation'
10+ import { usePathname , useRouter } from 'next/navigation'
1111import { getDesktopBridge , getDesktopShellVersion } from '@/lib/desktop'
1212import { ComputerUseSettings } from '@/app/workspace/[workspaceId]/settings/components/desktop/computer-use'
1313import { QuickChatShortcutSelect } from '@/app/workspace/[workspaceId]/settings/components/desktop/quick-chat-shortcut-select'
@@ -34,9 +34,8 @@ function PreferenceRow({ id, label, checked, disabled, onCheckedChange }: Prefer
3434}
3535
3636export function Desktop ( ) {
37- const params = useParams ( )
37+ const pathname = usePathname ( )
3838 const router = useRouter ( )
39- const workspaceId = params . workspaceId as string
4039 const [ preferences , setPreferences ] = useState < DesktopPreferences | null > ( null )
4140 const [ pendingPreference , setPendingPreference ] = useState < DesktopPreferenceKey | null > ( null )
4241 /** Whether Sim runs chats on this device in the background; only then can sleep matter. */
@@ -47,7 +46,8 @@ export function Desktop() {
4746 useEffect ( ( ) => {
4847 const bridge = getDesktopBridge ( )
4948 if ( ! bridge ) {
50- router . replace ( `/workspace/${ workspaceId } /settings/general` )
49+ // Workspace and organization settings both end in /desktop beside /general.
50+ router . replace ( pathname . replace ( / \/ d e s k t o p $ / , '/general' ) )
5151 return
5252 }
5353 void bridge . settings
@@ -59,7 +59,7 @@ export function Desktop() {
5959 . then ( ( device ) => setRunsInBackground ( device !== null ) )
6060 . catch ( ( ) => setRunsInBackground ( false ) )
6161 return bridge . settings . onFullFileAccessChanged ?.( setPreferences )
62- } , [ router , workspaceId ] )
62+ } , [ router , pathname ] )
6363
6464 const updatePreference = async ( key : DesktopPreferenceKey , value : boolean ) => {
6565 const settings = getDesktopBridge ( ) ?. settings
0 commit comments