Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: removed conditional to check for jslib files #36115

Merged
merged 2 commits into from
Sep 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
@@ -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<String> 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<Map.Entry<String, Object>> jsLibEntries =
applicationGitReference.getJsLibraries().entrySet();