Skip to content

Commit

Permalink
fix: Fix conditional hook in pro workspace view
Browse files Browse the repository at this point in the history
  • Loading branch information
PRTTMPRPHT authored and pascalbreuninger committed Dec 10, 2024
1 parent 22ece4c commit cc9e462
Showing 1 changed file with 11 additions and 12 deletions.
23 changes: 11 additions & 12 deletions desktop/src/views/Pro/Workspace/Workspace.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,17 @@ export function Workspace() {
}
}, [host, navigate, workspace])

const { store: storeTroubleshoot } = useStoreTroubleshoot()

const handleTroubleshootClicked = useCallback(() => {
if (workspace.data && workspaceActions) {
storeTroubleshoot({
workspace: workspace.data,
workspaceActions: workspaceActions,
})
}
}, [storeTroubleshoot, workspace.data, workspaceActions])

if (!instance) {
return (
<VStack align="start" gap="4">
Expand All @@ -117,9 +128,6 @@ export function Workspace() {
</VStack>
)
}

const { store: storeTroubleshoot } = useStoreTroubleshoot()

const canStop =
instance.status?.lastWorkspaceStatus != "Busy" &&
instance.status?.lastWorkspaceStatus != "Stopped"
Expand All @@ -135,15 +143,6 @@ export function Workspace() {

const lastActivity = getLastActivity(instance)

const handleTroubleshootClicked = useCallback(() => {
if (workspace.data && workspaceActions) {
storeTroubleshoot({
workspace: workspace.data,
workspaceActions: workspaceActions,
})
}
}, [storeTroubleshoot, workspace.data, workspaceActions])

return (
<>
<VStack align="start" width="full" height="full">
Expand Down

0 comments on commit cc9e462

Please sign in to comment.