mirror of
				https://github.com/Unleash/unleash.git
				synced 2025-10-27 11:02:16 +01:00 
			
		
		
		
	fix: display previously selected tags in dialog (#7271)
When opening a dialog where there's previously selected tags, also render the previously selected tags. This is consistent with how we do it for bulk tags. So instead of showing this when you open the tag manager on a flag with existing tags:  We show this: 
This commit is contained in:
		
							parent
							
								
									1c30fafd0f
								
							
						
					
					
						commit
						257cd5513f
					
				| @ -2,7 +2,6 @@ import { | |||||||
|     Autocomplete, |     Autocomplete, | ||||||
|     type AutocompleteProps, |     type AutocompleteProps, | ||||||
|     Checkbox, |     Checkbox, | ||||||
|     Chip, |  | ||||||
|     createFilterOptions, |     createFilterOptions, | ||||||
|     type FilterOptionsState, |     type FilterOptionsState, | ||||||
|     TextField, |     TextField, | ||||||
| @ -14,7 +13,6 @@ import IndeterminateCheckBoxIcon from '@mui/icons-material/IndeterminateCheckBox | |||||||
| import type { ITag, ITagType } from 'interfaces/tags'; | import type { ITag, ITagType } from 'interfaces/tags'; | ||||||
| import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; | import { ConditionallyRender } from 'component/common/ConditionallyRender/ConditionallyRender'; | ||||||
| import Add from '@mui/icons-material/Add'; | import Add from '@mui/icons-material/Add'; | ||||||
| import type { AutocompleteRenderGetTagProps } from '@mui/material/Autocomplete/Autocomplete'; |  | ||||||
| 
 | 
 | ||||||
| export type TagOption = { | export type TagOption = { | ||||||
|     title: string; |     title: string; | ||||||
| @ -88,22 +86,6 @@ export const TagsInput = ({ | |||||||
|         ); |         ); | ||||||
|     }; |     }; | ||||||
| 
 | 
 | ||||||
|     const renderTags = ( |  | ||||||
|         tagValue: TagOption[], |  | ||||||
|         getTagProps: AutocompleteRenderGetTagProps, |  | ||||||
|     ) => |  | ||||||
|         tagValue.map((option, index) => { |  | ||||||
|             const exists = existingTags.some( |  | ||||||
|                 (existingTag) => |  | ||||||
|                     existingTag.value === option.title && |  | ||||||
|                     existingTag.type === tagType.name, |  | ||||||
|             ); |  | ||||||
|             if (exists && indeterminateOptions === undefined) { |  | ||||||
|                 return null; |  | ||||||
|             } |  | ||||||
|             return <Chip {...getTagProps({ index })} label={option.title} />; |  | ||||||
|         }); |  | ||||||
| 
 |  | ||||||
|     const filterOptions = ( |     const filterOptions = ( | ||||||
|         options: TagOption[], |         options: TagOption[], | ||||||
|         params: FilterOptionsState<TagOption>, |         params: FilterOptionsState<TagOption>, | ||||||
| @ -134,7 +116,6 @@ export const TagsInput = ({ | |||||||
|             placeholder='Select Values' |             placeholder='Select Values' | ||||||
|             options={options} |             options={options} | ||||||
|             value={selectedOptions} |             value={selectedOptions} | ||||||
|             renderTags={renderTags} |  | ||||||
|             isOptionEqualToValue={(option, value) => { |             isOptionEqualToValue={(option, value) => { | ||||||
|                 if (value.inputValue && value.inputValue !== '') { |                 if (value.inputValue && value.inputValue !== '') { | ||||||
|                     return option.title === value.inputValue; |                     return option.title === value.inputValue; | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user