value can also be a string when using default value (#39202)

fixes: #38964

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
This commit is contained in:
Erik Jan de Wit 2025-04-25 13:02:43 +02:00 committed by GitHub
parent 68096ee27e
commit ab1c781601
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -49,6 +49,13 @@ export const ClientSelect = ({
defaultValue: defaultValue || "",
});
const getValue = (): string[] => {
if (typeof value === "string") {
return [value];
}
return value || [];
};
useFetch(
() => {
const params: ClientQuery = {
@ -66,7 +73,7 @@ export const ClientSelect = ({
useFetch(
() => {
const values = ((value as string[]) || []).map(async (clientId) => {
const values = getValue().map(async (clientId) => {
if (clientKey === "clientId") {
return (await adminClient.clients.find({ clientId }))[0];
} else {