Skip to content

Commit

Permalink
Fix
Browse files Browse the repository at this point in the history
  • Loading branch information
sjaanus committed Jan 2, 2025
1 parent e53993e commit b3fed0f
Showing 1 changed file with 13 additions and 11 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -195,17 +195,9 @@ export default class FeatureController extends Controller {
a.name.localeCompare(b.name),
);

const deepEqualIgnoreOrder = (obj1, obj2) => {
const sortedObj1 = JSON.parse(
JSON.stringify(obj1, Object.keys(obj1).sort()),
);
const sortedObj2 = JSON.parse(
JSON.stringify(obj2, Object.keys(obj2).sort()),
);
return isEqual(sortedObj1, sortedObj2);
};

if (!deepEqualIgnoreOrder(sortedToggles, sortedNewToggles)) {
if (
!this.deepEqualIgnoreOrder(sortedToggles, sortedNewToggles)
) {
this.logger.warn(
`old features and new features are different. Old count ${
features.length
Expand Down Expand Up @@ -407,4 +399,14 @@ export default class FeatureController extends Controller {
const jsonString = JSON.stringify(value);
return Buffer.byteLength(jsonString, 'utf8');
}

deepEqualIgnoreOrder = (obj1, obj2) => {
const sortedObj1 = JSON.parse(
JSON.stringify(obj1, Object.keys(obj1).sort()),
);
const sortedObj2 = JSON.parse(
JSON.stringify(obj2, Object.keys(obj2).sort()),
);
return isEqual(sortedObj1, sortedObj2);
};
}

0 comments on commit b3fed0f

Please sign in to comment.