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:
James Gatz 2022-10-31 12:32:23 +01:00 committed by GitHub
parent 9d2cb34107
commit 96487827bc
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 6 additions and 9 deletions

View File

@ -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?.();
},
});
},

View File

@ -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({

View File

@ -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>