TJRawlins / IrrigationManagerReact

Frontend irrigation management system (React TS)
1 stars 0 forks source link

BUG - React - Add & Edit plant console error when selecting from dropdowns #70

Closed TJRawlins closed 4 weeks ago

TJRawlins commented 1 month ago

Both Add Plant and Edit Plant combobox dropdowns give an error in the console (see image below) when a selection is made.

Image

TJRawlins commented 1 month ago

This is happening because the field is initially set to undefined (uncontrolled), then when a selection is made, it gets set to that value (controlled). To fix, just need to set initial value to a value or use a short-circuit evaluation value={fields.name || ""}.