diff options
Diffstat (limited to 'devtools/client/inspector/changes')
-rw-r--r-- | devtools/client/inspector/changes/reducers/changes.js | 2 | ||||
-rw-r--r-- | devtools/client/inspector/changes/selectors/changes.js | 31 |
2 files changed, 15 insertions, 18 deletions
diff --git a/devtools/client/inspector/changes/reducers/changes.js b/devtools/client/inspector/changes/reducers/changes.js index 23e82a3ba7..82a5a92ed7 100644 --- a/devtools/client/inspector/changes/reducers/changes.js +++ b/devtools/client/inspector/changes/reducers/changes.js @@ -371,7 +371,7 @@ const reducers = { return state; }, - [RESET_CHANGES](state) { + [RESET_CHANGES]() { return INITIAL_STATE; }, }; diff --git a/devtools/client/inspector/changes/selectors/changes.js b/devtools/client/inspector/changes/selectors/changes.js index a6b99e4579..a176e11082 100644 --- a/devtools/client/inspector/changes/selectors/changes.js +++ b/devtools/client/inspector/changes/selectors/changes.js @@ -65,7 +65,7 @@ function getChangesTree(state, filter = {}) { } return Object.entries(state) - .filter(([sourceId, source]) => { + .filter(([sourceId]) => { // Use only matching sources if an array to filter by was provided. if (sourceIdsFilter.length) { return sourceIdsFilter.includes(sourceId); @@ -87,7 +87,7 @@ function getChangesTree(state, filter = {}) { ...source, // Build a new collection of rules keyed by rule id. rules: Object.entries(rules) - .filter(([ruleId, rule]) => { + .filter(([ruleId]) => { // Use only matching rules if an array to filter by was provided. if (rulesIdsFilter.length) { return rulesIdsFilter.includes(ruleId); @@ -237,22 +237,19 @@ function getChangesStylesheet(state, filter) { } // Iterate through all sources in the change tree and build a CSS stylesheet string. - return Object.entries(changeTree).reduce( - (stylesheetText, [sourceId, source]) => { - const { href, rules } = source; - // Write code comment with source origin - stylesheetText += `\n/* ${getSourceForDisplay(source)} | ${href} */\n`; - // Write CSS rules - stylesheetText += Object.entries(rules).reduce((str, [ruleId, rule]) => { - // Add a new like only after top-level rules (level == 0) - str += writeRule(ruleId, rule, 0) + "\n"; - return str; - }, ""); + return Object.values(changeTree).reduce((stylesheetText, source) => { + const { href, rules } = source; + // Write code comment with source origin + stylesheetText += `\n/* ${getSourceForDisplay(source)} | ${href} */\n`; + // Write CSS rules + stylesheetText += Object.entries(rules).reduce((str, [ruleId, rule]) => { + // Add a new like only after top-level rules (level == 0) + str += writeRule(ruleId, rule, 0) + "\n"; + return str; + }, ""); - return stylesheetText; - }, - "" - ); + return stylesheetText; + }, ""); } module.exports = { |