LogBox - switch to array filter

Summary:
Fixes a bug for old versions of JSC that do not support `for of` syntax

Changelog: [Internal]

Reviewed By: fkgozali

Differential Revision: D18265611

fbshipit-source-id: 4643b6e2571c57ddd982661d188c3449f17a151e
This commit is contained in:
Rick Hanlon 2019-10-31 21:08:41 -07:00 коммит произвёл Facebook Github Bot
Родитель a7437710d2
Коммит 038353b89c
1 изменённых файлов: 4 добавлений и 8 удалений

Просмотреть файл

@ -56,9 +56,7 @@ function handleUpdate(): void {
updateTimeout = setImmediate(() => {
updateTimeout = null;
const logsSet = _isDisabled ? new Set() : logs;
for (const {observer} of observers) {
observer(logsSet);
}
observers.forEach(({observer}) => observer(logsSet));
});
}
}
@ -200,11 +198,9 @@ export function addIgnorePatterns(
// This allows adding an ignore pattern anywhere in the codebase.
// Without this, if you ignore a pattern after the a log is created,
// then we would keep showing the log.
for (let log of logs) {
if (isMessageIgnored(log.message.content)) {
logs.delete(log);
}
}
logs = new Set(
Array.from(logs).filter(log => !isMessageIgnored(log.message.content)),
);
}
handleUpdate();
}