Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 10 additions & 2 deletions ui/perfherder/alerts/StatusDropdown.jsx
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,14 @@ export default class StatusDropdown extends React.Component {

if (!culpritDetails.failureStatus) {
let cc = culpritDetails.ccList.add(result.cc_list);
const [product, component] = this.getBugComponent(culpritDetails);
cc = Array.from(cc);
defaultParams = {
...defaultParams,
cc,
needinfo_from: culpritDetails.needinfoFrom,
component: culpritDetails.component,
product: culpritDetails.product,
component: component,
product: product,
regressed_by: culpritId,
};
}
Expand Down Expand Up @@ -188,6 +189,13 @@ export default class StatusDropdown extends React.Component {
};
};

getBugComponent= (culpritDetails) => {
const overrides = new Map();
overrides.set(["Web Compatbility", "Site Reports"], ["Web Compatbility", "Interventions"]);

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo in "Compatbility".

The logic looks clean, but there is a subtle JS bug here: overrides.get(inputs) will always fail and return undefined. In JavaScript, arrays are compared by reference (memory location), not by value. Even if the text matches perfectly, a newly created array like inputs won't match the array used as the key in .set(). To fix this, use a primitive string as the key instead:

overrides.set("Web Compatbility|Site Reports", ["Web Compatbility", "Interventions"]);

return overrides.get(inputs.join('|')) ?? inputs;

const inputs = [culpritDetails.product, culpritDetails.component];
return overrides.get(inputs) ?? inputs;
}

getTemplateArgs(
frameworks,
alertSummary,
Expand Down