Skip to content

fix(search-input): accept nullable shared refs - #1824

Merged
FresnelR27 merged 1 commit into
developfrom
junyu/fix-replace-input-nullable-ref
Sep 15, 2026
Merged

FresnelR27 merged 1 commit into
developfrom
junyu/fix-replace-input-nullable-ref

Conversation

@beruro

@beruro beruro commented Sep 15, 2026

Copy link
Copy Markdown
Collaborator

Problem

The shared SearchInput test renders a heterogeneous [SearchInput, ReplaceInput] component list with one React ref type. Full TypeScript checking rejected the call at SearchInput.test.ts:79 because ReplaceInputProps.inputRef excluded null, while React refs are nullable before mount and after unmount. The two component prop contracts therefore produced incompatible generic ref types.

Solution

Allow null in the ReplaceInput input-ref element union. This aligns ReplaceInput with React's ref lifecycle and the existing SearchInput contract while preserving all runtime behavior.

Potential risks

Risk is limited to a compile-time type widening; rendering and ref assignment are unchanged. Mounted refs still point only to HTMLInputElement or HTMLTextAreaElement. No screenshot is useful because this change has no visual behavior.

Verification

  • pnpm exec vitest run --config config/vitest.config.ts src/components/SearchInput/SearchInput.test.ts — passed, 1 file and 2 tests
  • NODE_OPTIONS=--max-old-space-size=8192 pnpm exec tsc --noEmit --pretty false — passed; the default 4 GB attempt exhausted the Node heap before producing TypeScript diagnostics
  • git diff --check origin/develop...HEAD — passed
  • Normal pre-commit hooks ran without bypass: lint-staged, oxlint, ESLint/Prettier, and staged-file TypeScript checks passed

@FresnelR27
FresnelR27 merged commit 87bd765 into develop Sep 15, 2026
14 checks passed
@Harry19081 Harry19081 added bug Something isn't working frontend-ui Frontend UI, design system, accessibility, layout, or theming labels Sep 16, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

bug Something isn't working frontend-ui Frontend UI, design system, accessibility, layout, or theming

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants