diff --git a/app/server/appsmith-git/src/main/java/com/appsmith/git/files/FileUtilsCEImpl.java b/app/server/appsmith-git/src/main/java/com/appsmith/git/files/FileUtilsCEImpl.java index bc577881373..23891664b74 100644 --- a/app/server/appsmith-git/src/main/java/com/appsmith/git/files/FileUtilsCEImpl.java +++ b/app/server/appsmith-git/src/main/java/com/appsmith/git/files/FileUtilsCEImpl.java @@ -23,7 +23,6 @@ import org.json.JSONObject; import org.springframework.context.annotation.Import; import org.springframework.stereotype.Component; -import org.springframework.util.CollectionUtils; import org.springframework.util.FileSystemUtils; import org.springframework.util.StringUtils; import reactor.core.publisher.Mono; @@ -279,12 +278,16 @@ protected Set updateEntitiesInRepo(ApplicationGitReference applicationGi fileOperations.scanAndDeleteDirectoryForDeletedResources(validPages, baseRepo.resolve(PAGE_DIRECTORY)); - // Save JS Libs if there's at least one change - if (modifiedResources != null - && (modifiedResources.isAllModified() - || !CollectionUtils.isEmpty( - modifiedResources.getModifiedResourceMap().get(CUSTOM_JS_LIB_LIST)))) { + // Earlier this condition included that modified resource not be null, and + // it should either have allModified flag turned as true or CUSTOM_JS_LIB_LIST resource map is not empty + // Save JS Libs if there's at least one change. + // What are the possible caveats of making this change? + // Since each resource in the entry needs to be present in the Modified resource map to be written + // There won't be any differences in writing files. + // In terms of performance, we would need to access the customJSLib directory every time to + // compare with the valid js libs. + if (modifiedResources != null) { Path jsLibDirectory = baseRepo.resolve(JS_LIB_DIRECTORY); Set> jsLibEntries = applicationGitReference.getJsLibraries().entrySet();