Fix: call Object.keys twice

This commit is contained in:
eight 2019-02-13 10:24:41 +08:00
parent a7ffc9d477
commit ae2f45a3f0

View File

@ -322,13 +322,14 @@ const APPLY = (() => {
} }
function applyStyles(sections) { function applyStyles(sections) {
if (!Object.keys(sections).length) { const styles = Object.values(sections);
if (!styles.length) {
return Promise.resolve(); return Promise.resolve();
} }
return rootReady().then(() => return rootReady().then(() =>
docRootObserver.evade(() => docRootObserver.evade(() =>
styleInjector.addMany( styleInjector.addMany(
Object.values(sections).map(s => ({id: s.id, code: s.code.join('')})) styles.map(s => ({id: s.id, code: s.code.join('')}))
) )
) )
); );