refactor(renderer): adopt React 19 ref-as-prop + useActionState pilots - #245
Merged
Conversation
Two small, isolated React 19 feature-adoption migrations to establish the pattern. Full repo-wide migration is out of scope for this PR. 1. apps/desktop/src/renderer/src/components/ui/textarea.tsx forwardRef → ref as prop - Drops React.forwardRef wrapper - Declares `ref?: React.Ref<HTMLTextAreaElement>` on the prop type - Plain function component; React 19 handles ref forwarding natively 2. apps/desktop/src/renderer/src/components/sidebar/tag-delete-dialog.tsx useState(submitting) → useActionState - Replaces manual setSubmitting flag with useActionState's isPending - Wraps async handler inside startTransition for correct transition semantics - Adds createLogger-based error logging (per CLAUDE.md convention) No behavior change. Both pilots keep existing a11y semantics and styling. Plan: .claude/plans/tech-debt-remediation.md § 6.6
h4yfans
added a commit
that referenced
this pull request
May 6, 2026
#245) * refactor(renderer): adopt React 19 idioms in 2 pilot components Two small, isolated React 19 feature-adoption migrations to establish the pattern. Full repo-wide migration is out of scope for this PR. 1. apps/desktop/src/renderer/src/components/ui/textarea.tsx forwardRef → ref as prop - Drops React.forwardRef wrapper - Declares `ref?: React.Ref<HTMLTextAreaElement>` on the prop type - Plain function component; React 19 handles ref forwarding natively 2. apps/desktop/src/renderer/src/components/sidebar/tag-delete-dialog.tsx useState(submitting) → useActionState - Replaces manual setSubmitting flag with useActionState's isPending - Wraps async handler inside startTransition for correct transition semantics - Adds createLogger-based error logging (per CLAUDE.md convention) No behavior change. Both pilots keep existing a11y semantics and styling. Plan: .claude/plans/tech-debt-remediation.md § 6.6 * docs(react): add react-19-adoption.md covering 3 idioms + rollout
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Part of Phase 6 Tech Debt Remediation — see
.claude/plans/tech-debt-remediation.md § 6.6.Summary
Two isolated pilot migrations establishing the React 19 idiom pattern; no repo-wide sweep.
components/ui/textarea.tsx—forwardRef→refas a propReact.forwardRefwrapperref?: React.Ref<HTMLTextAreaElement>on the prop typecomponents/sidebar/tag-delete-dialog.tsx—useState(submitting)→useActionStatesetSubmittingflag withuseActionState'sisPendingstartTransitioncreateLogger('TagDeleteDialog').error(...)(per CLAUDE.md convention, replacing silent finally-only swallow)docs/react-19-adoption.mddocuments all three React 19 idioms, pilot examples, migration guidance, and explicit "do NOT migrate" rules (crypto-adjacent, auth, Electron bootstrap, complex dialog lifecycle likeTagRenameDialog).use(promise)is documented but not piloted — the renderer does not yet use<Suspense>boundaries, so no clean 1:1 target exists. Revisit when a suspense-driven route lands.Why
Being on React 19 is half the win; adopting idioms is the other half. Forced repo-wide migrations cause regressions; opportunistic drift-toward-19 while touching a file for other reasons is the stable pattern.
Test plan
pnpm typecheckgreen (textarea + dialog re-type)pnpm testgreen (no component tests broken)pnpm test:e2egreen (renderer render path covers both components)