diff --git a/packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.mock-route.$mockRouteId.update.tsx b/packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.mock-route.$mockRouteId.update.tsx index 654f7dd1b4a8..d8fd0f7180c0 100644 --- a/packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.mock-route.$mockRouteId.update.tsx +++ b/packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.mock-route.$mockRouteId.update.tsx @@ -21,27 +21,19 @@ export async function clientAction({ request, params }: Route.ClientActionArgs) invariant(typeof patch.name === 'string', 'Name is required'); invariant(patch.name.startsWith('/'), 'Path must begin with a /'); - const mockServer = await services.mockServer.getById(mockRoute.parentId); const existingRoutes = await services.mockRoute.findByParentId(mockRoute.parentId); - if (mockServer?.useInsomniaCloud) { - const hasRouteInServer = existingRoutes.filter(m => m._id !== mockRouteId).find(m => m.name === patch.name); - if (hasRouteInServer) { - invariant(false, `Path "${patch.name}" already exists. Please enter a different path.`); - } - } else { - const hasRouteInServer = existingRoutes - .filter(m => m._id !== mockRouteId) - .find( - m => m.name === patch.name && m.method.toUpperCase() === (patch.method || mockRoute.method).toUpperCase(), - ); + const hasRouteInServer = existingRoutes + .filter(m => m._id !== mockRouteId) + .find( + m => m.name === patch.name && m.method.toUpperCase() === (patch.method || mockRoute.method).toUpperCase(), + ); - if (hasRouteInServer) { - invariant( - false, - `Path "${patch.name}" with ${patch.method || mockRoute.method} method already exists. Please enter a different path or method.`, - ); - } + if (hasRouteInServer) { + invariant( + false, + `Path "${patch.name}" with ${patch.method || mockRoute.method} method already exists. Please enter a different path or method.`, + ); } } diff --git a/packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.mock-route.new.tsx b/packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.mock-route.new.tsx index 29c0572a0698..1189c8bfd883 100644 --- a/packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.mock-route.new.tsx +++ b/packages/insomnia/src/routes/organization.$organizationId.project.$projectId.workspace.$workspaceId.mock-server.mock-route.new.tsx @@ -19,24 +19,16 @@ export async function clientAction({ request, params }: Route.ClientActionArgs) invariant(patch.name.startsWith('/'), 'Path must begin with a /'); if (patch.parentId) { - const mockServer = await services.mockServer.getById(patch.parentId); const existingRoutes = await services.mockRoute.findByParentId(patch.parentId); - if (mockServer?.useInsomniaCloud) { - const hasRouteInServer = existingRoutes.find(m => m.name === patch.name); - if (hasRouteInServer) { - invariant(false, `Path "${patch.name}" already exists. Please enter a different path.`); - } - } else { - const hasRouteInServer = existingRoutes.find( - m => m.name === patch.name && m.method.toUpperCase() === patch.method?.toUpperCase(), + const hasRouteInServer = existingRoutes.find( + m => m.name === patch.name && m.method.toUpperCase() === patch.method?.toUpperCase(), + ); + if (hasRouteInServer) { + invariant( + false, + `Path "${patch.name}" with ${patch.method} method already exists. Please enter a different path or method.`, ); - if (hasRouteInServer) { - invariant( - false, - `Path "${patch.name}" with ${patch.method} method already exists. Please enter a different path or method.`, - ); - } } } // TODO: remove this hack which enables a mock server to be created alongside a route diff --git a/packages/insomnia/src/ui/components/modals/new-workspace-modal.tsx b/packages/insomnia/src/ui/components/modals/new-workspace-modal.tsx index 9d486eeb9cd0..16bf65821098 100644 --- a/packages/insomnia/src/ui/components/modals/new-workspace-modal.tsx +++ b/packages/insomnia/src/ui/components/modals/new-workspace-modal.tsx @@ -334,7 +334,6 @@ export const NewWorkspaceModal = ({ setWorkspaceData({ ...workspaceData, mockServerCreationType: creationType as 'ai' | 'manual', - mockServerType: creationType === 'ai' ? 'self-hosted' : workspaceData.mockServerType, }); }} className="mb-2 flex flex-col gap-2" @@ -628,7 +627,7 @@ export const NewWorkspaceModal = ({
- {workspaceData.mockServerCreationType === 'ai' - ? 'Not available when creating with Auto Generate.' - : isCloudMockDisabled - ? 'Only available for cloud projects' - : 'Runs on Insomnia cloud, ideal for collaboration.'} + {isCloudMockDisabled + ? 'Only available for cloud projects' + : 'Runs on Insomnia cloud, ideal for collaboration.'}