()
| 302 | |
| 303 | // Speed handling - parse bytes/s to display value using tracked unit |
| 304 | const getSpeedDisplay = (): { value: string; unit: number } => { |
| 305 | // Check raw stored value to distinguish empty from "0" |
| 306 | if (condition.value == null || condition.value === "") { |
| 307 | return { value: "", unit: speedUnit }; |
| 308 | } |
| 309 | const bytesPerSec = parseFloat(condition.value) || 0; |
| 310 | const display = bytesPerSec / speedUnit; |
| 311 | const decimals = DECIMALS_BY_SPEED_UNIT[speedUnit] ?? 2; |
| 312 | return { value: formatNumericInput(display, decimals), unit: speedUnit }; |
| 313 | }; |
| 314 | |
| 315 | const speedDisplay = fieldType === "speed" ? getSpeedDisplay() : null; |
| 316 |
no test coverage detected