mirror of
https://github.com/Kong/insomnia
synced 2024-11-08 06:39:48 +00:00
fix git clone not showing the document in project view (#5358)
* revalidate the data when cloning a document * properly redirect to a design document
This commit is contained in:
parent
9d2cb34107
commit
96487827bc
@ -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?.();
|
||||
},
|
||||
});
|
||||
},
|
||||
|
@ -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({
|
||||
|
@ -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 (
|
||||
<Fragment>
|
||||
|
Loading…
Reference in New Issue
Block a user