 
         dataProvider.ensureDefaultWorkspace ->
 
-          if machine
-            username = machine.getOwner()
-            data = machineUId: machine.uid, workspaceSlug: params.workspaceSlug
+          dataProvider.fetchWorkspaceByMachineUId data, (workspace) =>
+            if workspace
+              loadIDE { machine, workspace, username }
+            else
+              routeToMachineWorkspace machine
 
             dataProvider.fetchWorkspaceByMachineUId data, (workspace) =>
               if workspace then loadIDE { machine, workspace, username }


  return no if not machine or not workspace

  kd.singletons.mainView.activitySidebar.selectWorkspace data
  storage = kd.singletons.localStorageController.storage 'IDE'

  workspaceData    =

  else if machineLabel and workspaceSlug
    dataProvider.fetchMachineByLabel machineLabel, (machine, workspace) =>
      if machine and workspace
        actions.setSelectedWorkspaceId workspace._id
        router.handleRoute "/IDE/#{machineLabel}/#{workspaceSlug}"
      else if machine
        routeToMachineWorkspace machine
