@@ -5,7 +5,7 @@ import type { ActionFunction } from 'react-router-dom';
5
5
import type { PostmanDataDumpRawData } from '../../common/import' ;
6
6
import { fetchImportContentFromURI , getFilesFromPostmanExportedDataDump , type ImportFileDetail , importResourcesToProject , importResourcesToWorkspace , scanResources , type ScanResult } from '../../common/import' ;
7
7
import * as models from '../../models' ;
8
- import { isRemoteProject , ORG_STORAGE_RULE } from '../../models/project' ;
8
+ import { isRemoteProject } from '../../models/project' ;
9
9
import type { Workspace } from '../../models/workspace' ;
10
10
import { initializeLocalBackendProjectAndMarkForSync , pushSnapshotOnInitialize } from '../../sync/vcs/initialize-backend-project' ;
11
11
import { VCSInstance } from '../../sync/vcs/insomnia-sync' ;
@@ -149,7 +149,10 @@ async function syncNewWorkspaceIfNeeded(newWorkspace: Workspace) {
149
149
const project = await models . project . getById ( newWorkspace . parentId ) ;
150
150
invariant ( project , 'Project not found' ) ;
151
151
const userSession = await models . userSession . getOrCreate ( ) ;
152
- if ( userSession . id && isRemoteProject ( project ) && [ ORG_STORAGE_RULE . CLOUD_ONLY , ORG_STORAGE_RULE . CLOUD_PLUS_LOCAL ] . includes ( await fetchAndCacheOrganizationStorageRule ( project . parentId ) ) ) {
152
+ const storageRule = await fetchAndCacheOrganizationStorageRule ( project . parentId ) ;
153
+ invariant ( storageRule , 'Storage rule not found' ) ;
154
+
155
+ if ( userSession . id && isRemoteProject ( project ) && storageRule . enableCloudSync ) {
153
156
// Create default env, cookie jar, and meta
154
157
await models . environment . getOrCreateForParentId ( newWorkspace . _id ) ;
155
158
await models . cookieJar . getOrCreateForParentId ( newWorkspace . _id ) ;
0 commit comments