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
|
* Clone a git repository
|
||||||
* */
|
* */
|
||||||
export const cloneGitRepository = ({ createFsClient }: {
|
export const cloneGitRepository = ({ createFsClient, onComplete }: {
|
||||||
createFsClient: () => git.PromiseFsClient;
|
createFsClient: () => git.PromiseFsClient;
|
||||||
|
onComplete?: () => void;
|
||||||
}) => {
|
}) => {
|
||||||
return (dispatch: any, getState: () => RootState) => {
|
return (dispatch: any, getState: () => RootState) => {
|
||||||
// TODO: in the future we should ask which project to clone into...?
|
// TODO: in the future we should ask which project to clone into...?
|
||||||
@ -291,6 +292,7 @@ export const cloneGitRepository = ({ createFsClient }: {
|
|||||||
await db.flushChanges(bufferId);
|
await db.flushChanges(bufferId);
|
||||||
dispatch(loadStop());
|
dispatch(loadStop());
|
||||||
trackSegmentEvent(SegmentEvent.vcsSyncComplete, { ...vcsSegmentEventProperties('git', 'clone'), providerName });
|
trackSegmentEvent(SegmentEvent.vcsSyncComplete, { ...vcsSegmentEventProperties('git', 'clone'), providerName });
|
||||||
|
onComplete?.();
|
||||||
},
|
},
|
||||||
});
|
});
|
||||||
},
|
},
|
||||||
|
@ -90,12 +90,7 @@ export const createNewWorkspaceAction: ActionFunction = async ({
|
|||||||
await models.workspaceMeta.getOrCreateByParentId(workspace._id);
|
await models.workspaceMeta.getOrCreateByParentId(workspace._id);
|
||||||
|
|
||||||
await database.flushChanges(flushId);
|
await database.flushChanges(flushId);
|
||||||
if (session.isLoggedIn() && isRemoteProject(project)) {
|
if (session.isLoggedIn() && isRemoteProject(project) && isCollection(workspace)) {
|
||||||
if (!isCollection(workspace)) {
|
|
||||||
// Don't initialize and mark for sync unless we're in a collection
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const vcs = getVCS();
|
const vcs = getVCS();
|
||||||
if (vcs) {
|
if (vcs) {
|
||||||
initializeLocalBackendProjectAndMarkForSync({
|
initializeLocalBackendProjectAndMarkForSync({
|
||||||
|
@ -339,8 +339,8 @@ const ProjectRoute: FC = () => {
|
|||||||
}, [dispatch, revalidate]);
|
}, [dispatch, revalidate]);
|
||||||
|
|
||||||
const importFromGit = useCallback(() => {
|
const importFromGit = useCallback(() => {
|
||||||
dispatch(cloneGitRepository({ createFsClient: MemClient.createClient }));
|
dispatch(cloneGitRepository({ createFsClient: MemClient.createClient, onComplete: revalidate }));
|
||||||
}, [dispatch]);
|
}, [dispatch, revalidate]);
|
||||||
|
|
||||||
return (
|
return (
|
||||||
<Fragment>
|
<Fragment>
|
||||||
|
Loading…
Reference in New Issue
Block a user