Skip to content

Comments

chore: useController hook over Controller component#1590

Merged
g3john merged 3 commits intomainfrom
chore/use-controller-hook
Feb 17, 2026
Merged

chore: useController hook over Controller component#1590
g3john merged 3 commits intomainfrom
chore/use-controller-hook

Conversation

@g3john
Copy link
Contributor

@g3john g3john commented Feb 12, 2026

Summary

Replaces all usages of react-hook-form's Controller render-prop component with the useController hook across the codebase, resolving #1558.

@github-actions github-actions bot added the chore A miscellaneous change added to the application. label Feb 12, 2026
@github-actions
Copy link

github-actions bot commented Feb 12, 2026

Script size changes

Name +/- Main This PR Outcome
[411.js] = 2,178.85 kB 2,178.80 kB
[854.js] -0.05% 801.09 kB 800.68 kB
[datasource/module.js] = 25.18 kB 25.18 kB
[692.js] = 20.64 kB 20.64 kB
[663.js] = 5.83 kB 5.83 kB
[module.js] = 4.54 kB 4.54 kB
[156.js] = 1.90 kB 1.90 kB

Totals

Name +/- Main This PR Outcome
[Scripts] -0.01% 3,038.02 kB 3,037.57 kB
[Non-script Assets] = 2,677.50 kB 2,677.50 kB
[All] = 5,715.52 kB 5,715.07 kB

Generated by 🚫 dangerJS against 1e03583

invalid={!!periodError}
error={periodError}
validationMessageHorizontalOverflow={true}
disabled={!selected || formState.disabled}
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now that we're not using Controller, InlineField needs the disabled prop which propagates onto the child

@g3john g3john requested a review from VikaCep February 12, 2026 21:05
@g3john g3john marked this pull request as ready for review February 12, 2026 21:05
@g3john g3john requested a review from a team as a code owner February 12, 2026 21:05
ckbedwell
ckbedwell previously approved these changes Feb 13, 2026
Copy link
Contributor

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

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' });
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we need the controller here or is this all managed by the AlertsList already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah good catch. I switched the getValues to watch to see if we could remove useController but forgot to actually remove it

@g3john
Copy link
Contributor Author

g3john commented Feb 13, 2026

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?

Yeah let's leave that for now so that we don't have to introduce more cleanup later

@g3john g3john requested a review from ckbedwell February 13, 2026 18:56
Copy link
Contributor

@ckbedwell ckbedwell left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@g3john g3john merged commit dc5e6a6 into main Feb 17, 2026
36 checks passed
@g3john g3john deleted the chore/use-controller-hook branch February 17, 2026 14:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

chore A miscellaneous change added to the application.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants