Commit f73534ae authored by Clement Ho's avatar Clement Ho

Merge branch 'mfluharty-code-quality-worker-variable-mismatch' into 'master'

Fix variable mismatch in code quality widget

See merge request gitlab-org/gitlab-ee!14829
parents a416bd9d 0263d973
......@@ -96,9 +96,11 @@ export default class MergeRequestStore extends CEMergeRequestStore {
static doCodeClimateComparison(headIssues, baseIssues) {
// Do these comparisons in worker threads to avoid blocking the main thread
return new Promise(resolve => {
return new Promise((resolve, reject) => {
const worker = new CodeQualityComparisonWorker();
worker.addEventListener('message', ({ data }) => resolve(data));
worker.addEventListener('message', ({ data }) =>
data.newIssues && data.resolvedIssues ? resolve(data) : reject(data),
);
worker.postMessage({
headIssues,
baseIssues,
......
......@@ -7,15 +7,22 @@ self.addEventListener('message', e => {
const { data } = e;
if (data === undefined) {
return;
return null;
}
const { headIssues, baseIssues } = data;
if (!headIssues || !baseIssues) {
// eslint-disable-next-line no-restricted-globals
return self.postMessage({});
}
// eslint-disable-next-line no-restricted-globals
self.postMessage({
newIssues: filterByKey(data.parsedHeadIssues, data.parsedBaseIssues, keyToFilterBy),
resolvedIssues: filterByKey(data.parsedBaseIssues, data.parsedHeadIssues, keyToFilterBy),
newIssues: filterByKey(headIssues, baseIssues, keyToFilterBy),
resolvedIssues: filterByKey(baseIssues, headIssues, keyToFilterBy),
});
// eslint-disable-next-line no-restricted-globals
self.close();
return self.close();
});
---
title: Fix variable mismatch in code quality widget
merge_request: 14829
author:
type: fixed
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment