fix(tagging): change key from name to id for tagToSelectOption (#25856)

This commit is contained in:
Lily Kuang 2023-11-06 09:44:05 -08:00 committed by GitHub
parent fb35bac070
commit 30cd422331
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 20 additions and 1 deletions

View File

@ -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);
});
});

View File

@ -46,7 +46,7 @@ export const tagToSelectOption = (
): SelectTagsValue => ({
value: item.name,
label: item.name,
key: item.name,
key: item.id,
});
export const loadTags = async (