diff --git a/src/hooks/useCache.ts b/src/hooks/useCache.ts index 732f864b..65318828 100644 --- a/src/hooks/useCache.ts +++ b/src/hooks/useCache.ts @@ -15,14 +15,13 @@ export default ( }); const filledLabeledValues = React.useMemo(() => { - const { values: prevValueCache, options: prevOptionCache } = cacheRef.current; - + const {options: prevOptionCache } = cacheRef.current; // Fill label by cache const patchedValues = labeledValues.map((item) => { if (item.label === undefined) { return { ...item, - label: prevValueCache.get(item.value)?.label, + label: prevOptionCache.get(item.value)?.label, }; } diff --git a/tests/Select.test.tsx b/tests/Select.test.tsx index 413c80bf..e9c32b1b 100644 --- a/tests/Select.test.tsx +++ b/tests/Select.test.tsx @@ -1885,6 +1885,23 @@ describe('Select.Basic', () => { expect(findSelection(wrapper).text()).toEqual('903'); }); + it('value should be used as label When value does not have a label attribute and historical options do not contain value', () => { + const wrapper = mount(