Commit 529c70f1 authored by Coung Ngo's avatar Coung Ngo

Fix sidebar labels scoped label selection bug

When a scoped label is currently selected in the label dropdown,
then if another scoped label from the same set is picked then
the currently selected scoped label is sometimes not unselected.
parent cd170f47
......@@ -69,7 +69,8 @@ export default {
if (isScopedLabel(candidateLabel)) {
const scopedKeyWithDelimiter = `${scopedLabelKey(candidateLabel)}${SCOPED_LABEL_DELIMITER}`;
const currentActiveScopedLabel = state.labels.find(
({ title }) => title.startsWith(scopedKeyWithDelimiter) && title !== candidateLabel.title,
({ set, title }) =>
set && title.startsWith(scopedKeyWithDelimiter) && title !== candidateLabel.title,
);
if (currentActiveScopedLabel) {
......
......@@ -159,8 +159,9 @@ describe('LabelsSelect Mutations', () => {
labels = [
{ id: 1, title: 'scoped' },
{ id: 2, title: 'scoped::one', set: false },
{ id: 3, title: 'scoped::test', set: true },
{ id: 4, title: '' },
{ id: 3, title: 'scoped::two', set: false },
{ id: 4, title: 'scoped::three', set: true },
{ id: 5, title: '' },
];
});
......@@ -191,8 +192,9 @@ describe('LabelsSelect Mutations', () => {
expect(state.labels).toEqual([
{ id: 1, title: 'scoped' },
{ id: 2, title: 'scoped::one', set: true, touched: true },
{ id: 3, title: 'scoped::test', set: false },
{ id: 4, title: '' },
{ id: 3, title: 'scoped::two', set: false },
{ id: 4, title: 'scoped::three', set: false },
{ id: 5, title: '' },
]);
});
});
......
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