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

fixes: #38964

Signed-off-by: Erik Jan de Wit <erikjan.dewit@gmail.com>
(cherry picked from commit ab1c7816018e7482f37961370f27abddb4458ab4)
This commit is contained in:
Erik Jan de Wit 2025-05-01 15:58:22 +02:00 committed by GitHub
parent c727590c66
commit b4b6e086a3
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 {