Skip to content

Commit

Permalink
fix(tagging): change key from name to id for tagToSelectOption (apach…
Browse files Browse the repository at this point in the history
  • Loading branch information
lilykuang committed Nov 6, 2023
1 parent fb35bac commit 30cd422
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
19 changes: 19 additions & 0 deletions superset-frontend/src/components/Tags/utils.test.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
import { tagToSelectOption } from 'src/components/Tags/utils';

describe('tagToSelectOption', () => {
test('converts a Tag object with table_name to a SelectTagsValue', () => {
const tag = {
id: '1',
name: 'TagName',
table_name: 'Table1',
};

const expectedSelectTagsValue = {
value: 'TagName',
label: 'TagName',
key: '1',
};

expect(tagToSelectOption(tag)).toEqual(expectedSelectTagsValue);
});
});
2 changes: 1 addition & 1 deletion superset-frontend/src/components/Tags/utils.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export const tagToSelectOption = (
): SelectTagsValue => ({
value: item.name,
label: item.name,
key: item.name,
key: item.id,
});

export const loadTags = async (
Expand Down

0 comments on commit 30cd422

Please sign in to comment.