Skip to content

Commit 05cc17d

Browse files
authored
fix: TRAC-513 - clear stale variation override on stencil pull (#1374)
2 parents 3c69fd8 + 4a5beeb commit 05cc17d

1 file changed

Lines changed: 7 additions & 3 deletions

File tree

lib/stencil-pull.utils.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -74,15 +74,19 @@ utils.mergeThemeConfiguration = async (options) => {
7474
continue;
7575
}
7676
const defaultVal = localConfig.settings[key];
77+
// Compare against the variation override (when present) so stale ones get cleared.
78+
const effectiveLocalVal = _.has(variation.settings, key)
79+
? variation.settings[key]
80+
: defaultVal;
7781
// Check for different types, and throw an error if they are found
78-
if (typeof defaultVal !== typeof remoteVal) {
82+
if (typeof effectiveLocalVal !== typeof remoteVal) {
7983
throw new Error(
8084
`Theme configuration key "${key}" cannot be merged because it is not of the same type. ` +
81-
`Remote configuration is of type ${typeof remoteVal} while local configuration is of type ${typeof defaultVal}.`,
85+
`Remote configuration is of type ${typeof remoteVal} while local configuration is of type ${typeof effectiveLocalVal}.`,
8286
);
8387
}
8488
// If a different value is found, overwrite the local config
85-
if (!_.isEqual(defaultVal, remoteVal)) {
89+
if (!_.isEqual(effectiveLocalVal, remoteVal)) {
8690
if (!variation.settings) {
8791
variation.settings = {};
8892
}

0 commit comments

Comments
 (0)