Skip to content

fix: pass null to combined refs on unmount - #358

Merged
JoshTheWanderer merged 1 commit into
mainfrom
fix/checkbox-ref-unmount
Oct 23, 2026
Merged

JoshTheWanderer merged 1 commit into
mainfrom
fix/checkbox-ref-unmount

Conversation

@JoshTheWanderer

@JoshTheWanderer JoshTheWanderer commented Oct 23, 2026 •

Copy link
Copy Markdown
Member

useCombinedRefs assigns the forwarded refs from an effect and never cleans up. A callback ref such as react-hook-form's register() never receives null when the element unmounts. The form keeps validating a field whose inputs are gone.

LA Portal hit this bug first. Hiding the HWRC payment options group, a required Checkbox group, left the form unable to submit with no error on screen. Any Checkbox rendered behind a conditional can hit this. Only components that use useCombinedRefs are affected.

The effect now returns a cleanup that assigns null to each ref.

useCombinedRefs assigned the forwarded refs from an effect with no
cleanup. A callback ref never received null when the element unmounted.
react-hook-form uses that null call to stop validating a field. A
conditional that hid a required Checkbox group kept blocking submit
with no visible error.
@JoshTheWanderer
JoshTheWanderer force-pushed the fix/checkbox-ref-unmount branch from 02554b2 to 8cba5a4 Compare October 23, 2026 15:51
@mergify
mergify Bot requested review from a team and gavmck and removed request for a team October 23, 2026 15:51
@mergify
mergify Bot requested a review from a team October 23, 2026 15:52
@github-actions

github-actions Bot commented Oct 23, 2026 •

Copy link
Copy Markdown

🦙 MegaLinter status: ✅ SUCCESS

Descriptor Linter Files Fixed Errors Elapsed time
✅ EDITORCONFIG editorconfig-checker 1 0 0.01s
✅ REPOSITORY checkov yes no 20.29s
✅ REPOSITORY gitleaks yes no 8.14s
✅ REPOSITORY git_diff yes no 0.03s
✅ REPOSITORY secretlint yes no 1.49s
✅ REPOSITORY trivy-sbom yes no 2.8s
✅ REPOSITORY trufflehog yes no 4.84s
✅ TYPESCRIPT eslint 1 0 6.44s

See detailed report in MegaLinter reports
Set VALIDATE_ALL_CODEBASE: true in mega-linter.yml to validate all sources, not only the diff

MegaLinter is graciously provided by OX Security

@JoshTheWanderer
JoshTheWanderer merged commit 9712883 into main Oct 23, 2026
14 checks passed
@JoshTheWanderer
JoshTheWanderer deleted the fix/checkbox-ref-unmount branch October 23, 2026 16:21
DanWebb pushed a commit that referenced this pull request Oct 23, 2026
## <small>9.4.1 (2026-10-23)</small>

* Merge pull request #334 from etchteam/mergify/configuration-deprecated-update ([6042157](6042157)), closes [#334](#334)
* Merge pull request #353 from etchteam/chore/dependabot-bundle ([2e22eb6](2e22eb6)), closes [#353](#353)
* Merge pull request #357 from etchteam/dependabot/npm_and_yarn/follow-redirects-1.16.1 ([8bff529](8bff529)), closes [#357](#357)
* Merge pull request #358 from etchteam/fix/checkbox-ref-unmount ([9712883](9712883)), closes [#358](#358)
* fix: pass null to combined refs on unmount ([8cba5a4](8cba5a4))
* chore: bump dependabot dependencies ([f95b5ac](f95b5ac))
* chore: bump follow-redirects from 1.16.0 to 1.16.1 ([4802969](4802969))
* chore: keep @svgr/webpack on 5.5.0 ([fc2f63c](fc2f63c))
* chore: restore stylelint typescript peer in lockfile ([391436c](391436c))
* ci(mergify): upgrade configuration to current format ([08a419d](08a419d))
@DanWebb

DanWebb commented Oct 23, 2026

Copy link
Copy Markdown
Member

🎉 This PR is included in version 9.4.1 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Development

Successfully merging this pull request may close these issues.

2 participants