#ColorInput optimization in controlled mode?

10 messages · Page 1 of 1 (latest)

solid ravine
#

i need to use controlled mode, because I'm controlling a field's disabled status with a checkbox. in the same form Im also using ColorInput but it's very slow because the whole form rerenders on change. Is there a way to optimize this somehow?

carmine ferry
solid ravine
#

just dragging the mouse over the picker results in rerendering

solid ravine
#

does this mean this is correct? i don't pass key and getInputProps to ColorInput?

  onChangeEnd={(v) => {
    form.setFieldValue(`statuses.${index}.color`, v);
  }}
  format="hexa"
  popoverProps={{ position: "bottom" }}
  defaultValue={element.color}
  fixOnBlur
  // key={form.key(`statuses.${index}.color`)}
  // {...form.getInputProps(`statuses.${index}.color`)}
/>```
warped rover
solid ravine
#

okay. thank u

#

but settings the form field onChangeEnd is "alright"?

#

what does "key={form.key(statuses.${index}.color)}" do in this case by itself exactly?

warped rover
#

form.key is required for uncontrolled form mode to work