react-ui icon indicating copy to clipboard operation
react-ui copied to clipboard

Change from `null` to `undefined` introduces issues with `<value> !== undefined`

Open bedrich-schindler opened this issue 1 month ago • 0 comments

This is caused by https://github.com/react-ui-org/react-ui/issues/662


As result of mentioned change, TextField is incorrectly setting hasRootSmallInput class when inputSize is set to null. This is happening on following line: https://github.com/react-ui-org/react-ui/blob/master/src/components/TextField/TextField.jsx#L35

Problem is that if inputSize is set to null:

const hasSmallInput = (inputSize !== undefined) && (inputSize <= SMALL_INPUT_SIZE);

Then inputSize is true because of inputSize <= SMALL_INPUT_SIZE => true. Why? Because null <= 10 ...

We need to investigate this and examine all occurrences of !== undefined and !== null as well. This is why I always recommend using != null to cover both cases.

bedrich-schindler avatar Nov 13 '25 19:11 bedrich-schindler