diff --git a/client/src/components/inputs/Select.tsx b/client/src/components/inputs/Select.tsx index a38dfba2f..f74b17065 100644 --- a/client/src/components/inputs/Select.tsx +++ b/client/src/components/inputs/Select.tsx @@ -1,4 +1,5 @@ import Select from "@mui/material/Select"; +import React from "react"; import { useTheme } from "@mui/material/styles"; import type { SelectProps } from "@mui/material/Select"; import Stack from "@mui/material/Stack"; @@ -42,10 +43,21 @@ export const SelectInput = ({ const capitalized = items.map( (item) => item.charAt(0).toUpperCase() + item.slice(1) ); - return {capitalized.join(" | ")} as any; + return ({capitalized.join(" | ")}) as any; } - return selected as any; + const nodes = React.Children.toArray(props.children as React.ReactNode); + for (const node of nodes) { + if (!React.isValidElement(node)) continue; + const el = node as React.ReactElement<{ + value?: unknown; + children?: React.ReactNode; + }>; + if (el.props?.value === selected) { + return (el.props.children ?? selected) as React.ReactNode; + } + } + return selected as React.ReactNode; }; const select = (