MCPcopy Index your code
hub / github.com/simstudioai/sim / handleWorkflowRedirect

Function handleWorkflowRedirect

apps/sim/app/workspace/page.tsx:82–101  ·  view source on GitHub ↗
(
  workflowId: string,
  fallbackWorkspaceId: string,
  router: ReturnType<typeof useRouter>
)

Source from the content-addressed store, hash-verified

80}
81
82async function handleWorkflowRedirect(
83 workflowId: string,
84 fallbackWorkspaceId: string,
85 router: ReturnType<typeof useRouter>
86): Promise<void> {
87 try {
88 const workflowData = await requestJson(getWorkflowStateContract, {
89 params: { id: workflowId },
90 })
91 const workspaceId = workflowData.data.workspaceId
92 if (workspaceId) {
93 logger.info(`Redirecting workflow ${workflowId} to workspace ${workspaceId}`)
94 router.replace(`/workspace/${workspaceId}/w/${workflowId}`)
95 return
96 }
97 } catch (error) {
98 logger.error('Error fetching workflow for redirect:', error)
99 }
100 router.replace(`/workspace/${fallbackWorkspaceId}/home`)
101}
102
103async function handleNoWorkspaces(
104 router: ReturnType<typeof useRouter>,

Callers 1

WorkspacePageFunction · 0.85

Calls 4

requestJsonFunction · 0.90
infoMethod · 0.80
errorMethod · 0.80
replaceMethod · 0.65

Tested by

no test coverage detected