Skip to content

Commit

Permalink
fix checkout stuck on loading state
Browse files Browse the repository at this point in the history
  • Loading branch information
gatzjames committed Nov 22, 2023
1 parent 026cbc7 commit 710b02f
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
8 changes: 5 additions & 3 deletions packages/insomnia/src/ui/routes/remote-collections.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { ActionFunction, LoaderFunction } from 'react-router-dom';
import { ActionFunction, LoaderFunction, redirect } from 'react-router-dom';

import { database, Operation } from '../../common/database';
import { isNotNullOrUndefined } from '../../common/misc';
Expand Down Expand Up @@ -267,7 +267,9 @@ export const syncDataLoader: LoaderFunction = async ({ params }): Promise<SyncDa
};

export const checkoutBranchAction: ActionFunction = async ({ request, params }) => {
const { workspaceId } = params;
const { organizationId, projectId, workspaceId } = params;
invariant(typeof organizationId === 'string', 'Organization Id is required');
invariant(typeof projectId === 'string', 'Project Id is required');
invariant(typeof workspaceId === 'string', 'Workspace Id is required');
const formData = await request.formData();
const branch = formData.get('branch');
Expand All @@ -285,7 +287,7 @@ export const checkoutBranchAction: ActionFunction = async ({ request, params })
};
}

return {};
return redirect(`/organization/${organizationId}/project/${projectId}/workspace/${workspaceId}/debug`);
};

export const mergeBranchAction: ActionFunction = async ({ request, params }) => {
Expand Down
6 changes: 2 additions & 4 deletions packages/insomnia/src/ui/routes/workspace.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import React from 'react';
import { LoaderFunction, Outlet, useLoaderData } from 'react-router-dom';
import { LoaderFunction, Outlet } from 'react-router-dom';

import { isLoggedIn } from '../../account/session';
import { SortOrder } from '../../common/constants';
Expand Down Expand Up @@ -256,9 +256,7 @@ export const workspaceLoader: LoaderFunction = async ({
};

const WorkspaceRoute = () => {
const workspaceData = useLoaderData() as WorkspaceLoaderData;
const branch = workspaceData.activeWorkspaceMeta.cachedGitRepositoryBranch;
return <Outlet key={branch} />;
return <Outlet />;
};

export default WorkspaceRoute;

0 comments on commit 710b02f

Please sign in to comment.