|
23 | 23 | import org.json.JSONObject;
|
24 | 24 | import org.springframework.context.annotation.Import;
|
25 | 25 | import org.springframework.stereotype.Component;
|
26 |
| -import org.springframework.util.CollectionUtils; |
27 | 26 | import org.springframework.util.FileSystemUtils;
|
28 | 27 | import org.springframework.util.StringUtils;
|
29 | 28 | import reactor.core.publisher.Mono;
|
@@ -279,12 +278,16 @@ protected Set<String> updateEntitiesInRepo(ApplicationGitReference applicationGi
|
279 | 278 |
|
280 | 279 | fileOperations.scanAndDeleteDirectoryForDeletedResources(validPages, baseRepo.resolve(PAGE_DIRECTORY));
|
281 | 280 |
|
282 |
| - // Save JS Libs if there's at least one change |
283 |
| - if (modifiedResources != null |
284 |
| - && (modifiedResources.isAllModified() |
285 |
| - || !CollectionUtils.isEmpty( |
286 |
| - modifiedResources.getModifiedResourceMap().get(CUSTOM_JS_LIB_LIST)))) { |
| 281 | + // Earlier this condition included that modified resource not be null, and |
| 282 | + // it should either have allModified flag turned as true or CUSTOM_JS_LIB_LIST resource map is not empty |
| 283 | + // Save JS Libs if there's at least one change. |
287 | 284 |
|
| 285 | + // What are the possible caveats of making this change? |
| 286 | + // Since each resource in the entry needs to be present in the Modified resource map to be written |
| 287 | + // There won't be any differences in writing files. |
| 288 | + // In terms of performance, we would need to access the customJSLib directory every time to |
| 289 | + // compare with the valid js libs. |
| 290 | + if (modifiedResources != null) { |
288 | 291 | Path jsLibDirectory = baseRepo.resolve(JS_LIB_DIRECTORY);
|
289 | 292 | Set<Map.Entry<String, Object>> jsLibEntries =
|
290 | 293 | applicationGitReference.getJsLibraries().entrySet();
|
|
0 commit comments