diff --git a/packages/insomnia/src/ui/redux/modules/git.tsx b/packages/insomnia/src/ui/redux/modules/git.tsx index 8be3e6c3f..98a847cd0 100644 --- a/packages/insomnia/src/ui/redux/modules/git.tsx +++ b/packages/insomnia/src/ui/redux/modules/git.tsx @@ -153,8 +153,9 @@ const noDocumentFound = (gitRepo: GitRepository) => { /** * Clone a git repository * */ -export const cloneGitRepository = ({ createFsClient }: { +export const cloneGitRepository = ({ createFsClient, onComplete }: { createFsClient: () => git.PromiseFsClient; + onComplete?: () => void; }) => { return (dispatch: any, getState: () => RootState) => { // TODO: in the future we should ask which project to clone into...? @@ -291,6 +292,7 @@ export const cloneGitRepository = ({ createFsClient }: { await db.flushChanges(bufferId); dispatch(loadStop()); trackSegmentEvent(SegmentEvent.vcsSyncComplete, { ...vcsSegmentEventProperties('git', 'clone'), providerName }); + onComplete?.(); }, }); }, diff --git a/packages/insomnia/src/ui/routes/actions.tsx b/packages/insomnia/src/ui/routes/actions.tsx index ee80815bd..9b02ed984 100644 --- a/packages/insomnia/src/ui/routes/actions.tsx +++ b/packages/insomnia/src/ui/routes/actions.tsx @@ -90,12 +90,7 @@ export const createNewWorkspaceAction: ActionFunction = async ({ await models.workspaceMeta.getOrCreateByParentId(workspace._id); await database.flushChanges(flushId); - if (session.isLoggedIn() && isRemoteProject(project)) { - if (!isCollection(workspace)) { - // Don't initialize and mark for sync unless we're in a collection - return; - } - + if (session.isLoggedIn() && isRemoteProject(project) && isCollection(workspace)) { const vcs = getVCS(); if (vcs) { initializeLocalBackendProjectAndMarkForSync({ diff --git a/packages/insomnia/src/ui/routes/project.tsx b/packages/insomnia/src/ui/routes/project.tsx index a3b60a517..71cb6dbff 100644 --- a/packages/insomnia/src/ui/routes/project.tsx +++ b/packages/insomnia/src/ui/routes/project.tsx @@ -339,8 +339,8 @@ const ProjectRoute: FC = () => { }, [dispatch, revalidate]); const importFromGit = useCallback(() => { - dispatch(cloneGitRepository({ createFsClient: MemClient.createClient })); - }, [dispatch]); + dispatch(cloneGitRepository({ createFsClient: MemClient.createClient, onComplete: revalidate })); + }, [dispatch, revalidate]); return (