Skip to content

followup to Fix/textinput inputref - #650

Closed
flacoman91 wants to merge 2 commits into
mainfrom
fix/textinput-inputref
Closed

flacoman91 wants to merge 2 commits into
mainfrom
fix/textinput-inputref

Conversation

@flacoman91

@flacoman91 flacoman91 commented Oct 22, 2026 •

Copy link
Copy Markdown
Collaborator

Follow-up to #649.

Thanks @soroush5 for your PR. I opened another PR to get our CI tests to run and also I had to add in some tests

Changes

  • Memoize the merged ref callback so a stable inputRef or forwarded ref stays attached across rerenders
  • Return a cleanup from that callback, matching React 19: run a cleanup function when a ref callback returns one, otherwise call it with null, and set object refs back to null on detach
  • Add tests for rerender stability, unmount cleanup, and the legacy null callback path

How to test this PR

  1. yarn vitest run src/components/text-input/text-input.test.tsx
  2. Pass a stable inputRef callback and confirm it is not called with null on rerender
  3. Return a cleanup from inputRef and confirm it runs on unmount

@github-actions

github-actions Bot commented Oct 22, 2026 •

Copy link
Copy Markdown
PR Preview Action v1.8.1
Preview removed because the pull request was closed.
2026-10-23 21:11 UTC

@flacoman91
flacoman91 marked this pull request as ready for review October 22, 2026 00:11
@flacoman91 flacoman91 closed this Oct 23, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants