convert multi_number values to number when storing

merge-requests/3361/merge^2
Siddharth Singh 2025-04-01 13:54:09 +05:30
rodzic 0679b44652
commit 3eba2b9a89
Nie znaleziono w bazie danych klucza dla tego podpisu
1 zmienionych plików z 12 dodań i 1 usunięć

Wyświetl plik

@ -67,7 +67,18 @@ export const PolicyFields: FC<{
const currentValue = Array.isArray(value) ? value : [];
if (!currentValue.includes(inputValue)) {
// Convert to number for multi_number fields
const processedValue = schema.type === 'multi_number'
? Number(inputValue)
: inputValue;
// Check for NaN when converting to number
if (schema.type === 'multi_number' && isNaN(processedValue as number)) {
// Show error or return
return;
}
if (!currentValue.includes(processedValue)) {
dispatch({ type: 'ADD_MULTI_VALUE', policyName, fieldName: name, value: inputValue });
}