chore: useController hook over Controller component#1590
Conversation
Script size changes
Totals
|
| invalid={!!periodError} | ||
| error={periodError} | ||
| validationMessageHorizontalOverflow={true} | ||
| disabled={!selected || formState.disabled} |
There was a problem hiding this comment.
Now that we're not using Controller, InlineField needs the disabled prop which propagates onto the child
ckbedwell
left a comment
There was a problem hiding this comment.
One small question where I think there is some redundancy but otherwise LGTM!
We usually have to deconstruct all the refs and omit them from being passed down as we aren't using forwardRef wrappers for our components so I was about to suggest while we're at it in this PR let's reduce some of the console noise in the tests but I think when we move to React 19 it has killed the need to use forwardRef wrappers so I'm happy to leave that work and see if it gets killed when we transition?
| const selectedAlerts = getValues('alerts'); | ||
| const selectedAlerts = watch('alerts'); | ||
|
|
||
| useController({ control, name: 'alerts' }); |
There was a problem hiding this comment.
Do we need the controller here or is this all managed by the AlertsList already?
There was a problem hiding this comment.
Ah good catch. I switched the getValues to watch to see if we could remove useController but forgot to actually remove it
Yeah let's leave that for now so that we don't have to introduce more cleanup later |
Summary
Replaces all usages of
react-hook-form'sControllerrender-prop component with theuseControllerhook across the codebase, resolving #1558.