Skip to content

Commit

Permalink
chore(27766): a bit of cleaning
Browse files Browse the repository at this point in the history
  • Loading branch information
vanch3d committed Nov 18, 2024
1 parent 27b6743 commit 7fbce19
Showing 1 changed file with 10 additions and 10 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ const EntityCreatableSelect: FC<EntitySelectProps> = ({
const { t } = useTranslation('components')
const safeValue = useMemo(() => {
if (value === null) return null
if (isMulti) return (value as MultiValue<string>).map((w: string) => ({ label: w, value: w }))
if (isMulti) return (value as MultiValue<string>).map((value: string) => ({ label: value, value }))
return { label: value as string, value: value as string }
}, [isMulti, value])
const safeOnChange = useCallback(
Expand All @@ -114,7 +114,7 @@ const EntityCreatableSelect: FC<EntitySelectProps> = ({
return
}
if (isMulti) {
onChange((value as MultiValue<EntityOption>).map((w) => w.value))
onChange((value as MultiValue<EntityOption>).map((option) => option.value))
return
}

Expand Down Expand Up @@ -165,9 +165,9 @@ interface CreateSelectableProps {
export const SelectTopic: FC<CreateSelectableProps> = (props) => {
const { data, isLoading } = useGetEdgeTopics({ publishOnly: false })
const options =
data.map<EntityOption>((e) => ({
label: e,
value: e,
data.map<EntityOption>((topic) => ({
label: topic,
value: topic,
})) || []

return (
Expand All @@ -184,10 +184,10 @@ export const SelectTopic: FC<CreateSelectableProps> = (props) => {
export const SelectTopicFilter: FC<CreateSelectableProps> = (props) => {
const { data, isLoading } = useListTopicFilters()
const options =
data?.items?.map<EntityOption>((e) => ({
label: e.topicFilter,
value: e.topicFilter,
description: e.description,
data?.items?.map<EntityOption>((filter) => ({
label: filter.topicFilter,
value: filter.topicFilter,
description: filter.description,
})) || []

return (
Expand All @@ -207,7 +207,7 @@ interface TagSelectProps extends CreateSelectableProps {

export const SelectTag: FC<TagSelectProps> = ({ adapterId, ...rest }) => {
const { data, isLoading } = useGetDomainTags(adapterId)
const options = data?.items?.map<EntityOption>((e) => ({ label: e.tag, value: e.tag })) || []
const options = data?.items?.map<EntityOption>((tag) => ({ label: tag.tag, value: tag.tag })) || []

return (
<EntityCreatableSelect
Expand Down

0 comments on commit 7fbce19

Please sign in to comment.