Skip to content

Commit 24f435a

Browse files
committed
fix: clean up redundant cloning
1 parent 0b4d895 commit 24f435a

2 files changed

Lines changed: 3 additions & 5 deletions

File tree

backend/lib/cache/index.js

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,6 @@ export default {
7878
return _
7979
.chain(cache.getCloudProfiles())
8080
.find(['metadata.name', name])
81-
.cloneDeep()
8281
.value()
8382
},
8483
getNamespacedCloudProfiles (namespace) {

backend/lib/services/namespacedCloudProfiles.js

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -29,12 +29,11 @@ function computeDiff (namespacedCloudProfile) {
2929
return null
3030
}
3131

32-
// Simplify both profiles to ensure consistent providerConfig filtering
33-
const simplifiedParent = simplifyCloudProfile(_.cloneDeep(parentCloudProfile))
34-
const simplifiedNamespaced = _.cloneDeep(namespacedCloudProfile)
32+
// parentCloudProfile is already cloned by cache.getCloudProfile(name)
33+
const simplifiedParent = simplifyCloudProfile(parentCloudProfile)
3534

3635
const parentSpec = _.get(simplifiedParent, ['spec'], {})
37-
const namespacedSpec = _.get(simplifiedNamespaced, ['status', 'cloudProfileSpec'], {})
36+
const namespacedSpec = _.get(namespacedCloudProfile, ['status', 'cloudProfileSpec'], {})
3837

3938
return jsondiffpatch.diff(parentSpec, namespacedSpec)
4039
}

0 commit comments

Comments
 (0)