Skip to content

chore(dashboard): replace forwardRef with ref as a prop - #5443

Merged
robertkasza merged 1 commit into
mainfrom
chore/dashboard-remove-forwardref
Nov 25, 2026
Merged

robertkasza merged 1 commit into
mainfrom
chore/dashboard-remove-forwardref

Conversation

@robertkasza

@robertkasza robertkasza commented Nov 24, 2026 •

Copy link
Copy Markdown
Member

React 19 passes ref as a regular prop, so forwardRef isn't needed anymore.

  • Enables Biome's noReactForwardRef in dashboard/biome.json, so new forwardRef usage fails lint.
  • Converts the 58 dashboard components that used forwardRef to take ref as a prop. Radix wrappers in ui/v3 are typed with React.ComponentProps<typeof Primitive.X>, which includes ref; the generic form components (FormInput, FormSelect, …) lose their forwardRef(...) as <...> casts.
  • Removes the displayName assignments that only existed because of forwardRef. Nothing reads them; the only visible change is ReadOnlyToggle showing under its function name in React DevTools.
  • Updates .claude/docs/javascript-design-rules.md, which still asked for forwardRef.

landing/ still has 4 forwardRef uses; they're out of scope here.

Checklist

  • No breaking changes
  • Tests pass (biome check, tsc --noEmit, Vitest on the 20 test files next to the changed components; full suite left to CI)
  • New features have new tests (n/a)
  • Documentation is updated (if applicable)
  • Title of the PR is in the correct format

Goal

The dashboard runs on React 19, where function components receive ref as an ordinary prop and React.forwardRef is deprecated. 58 dashboard components still wrapped themselves in forwardRef, and the JS design rules still told contributors to use it. This branch moves every dashboard component to the React 19 ref-as-prop pattern without changing runtime behavior or public component APIs, and adds a lint rule so forwardRef cannot return. landing/ is explicitly out of scope.

Type: Refactoring

Changes

  • Lint guard — dashboard/biome.json enables Biome's noReactForwardRef rule, so any new forwardRef call in the dashboard fails biome check.
  • Radix and Shadcn wrappers (ui/v3) — each React.forwardRef<ComponentRef<typeof P>, ComponentPropsWithoutRef<typeof P>>((props, ref) => …) becomes a plain arrow component that destructures ref from React.ComponentProps<typeof P> (which already includes ref) and forwards it to the primitive. import * as React becomes import type * as React where React is now only used for types.
  • Generic form components — FormCheckbox, FormInput, FormPasswordInput, FormSelect, FormSwitch and FormTextarea were inner generic functions wrapped by forwardRef(...) and cast back to a generic signature. They are now the exported generic function itself, taking ref?: Ref<…> in props, so TFieldValues/TName inference works without the cast. Refs are still merged with the react-hook-form field ref via mergeRefs.
  • Other shared and feature components — NavLink, TimePicker, SettingsCard family, SidebarItem, CodeBlock, Logo, NhostIcon, ReadOnlyToggle and nine feature components (data grid triggers, logs table and search bar, column autocomplete, remote schema tree, etc.) follow the same pattern; most of the line churn is re-indentation from removing the wrapper.
  • displayName removal — assignments that existed only because forwardRef returns an anonymous component are deleted; components now report their variable or function name in React DevTools.
  • Design rules — .claude/docs/javascript-design-rules.md now asks for ref as a regular prop and documents typing Radix wrappers with React.ComponentProps.

Key files

  • dashboard/biome.json (+2/-1) — enables noReactForwardRef
  • dashboard/src/components/ui/v3/* (30 files) — Radix/Shadcn wrappers converted
  • dashboard/src/components/form/* (6 files, +134/-206) — generic form components without casts
  • dashboard/src/components/{common,layout,presentational}/* (14 files) — shared components converted
  • dashboard/src/features/orgs/projects/** (9 files) — feature components converted, mostly re-indentation
  • .claude/docs/javascript-design-rules.md (+1/-1) — rule update

@github-actions

github-actions Bot commented Nov 24, 2026 •

Copy link
Copy Markdown
Contributor

Vercel Deployment Info - dashboard

@robertkasza
robertkasza force-pushed the chore/dashboard-remove-forwardref branch from af53e6f to 7c1caff Compare November 24, 2026 11:22
@robertkasza robertkasza self-assigned this Nov 24, 2026
@robertkasza
robertkasza force-pushed the chore/dashboard-remove-forwardref branch from e0241b3 to 0e5c2eb Compare November 24, 2026 14:31
React 19 passes ref as a regular prop, so forwardRef is no longer needed.
Enable Biome's noReactForwardRef so it doesn't come back, convert the 58
dashboard components that used it, and drop the displayName assignments
that only existed because of forwardRef. Radix wrappers are typed with
React.ComponentProps, which includes ref, and the generic form
components no longer need their forwardRef type casts.

Update the JS design rules, which still asked for forwardRef.

Checks: biome check, tsc --noEmit, and Vitest on the 20 test files next
to the changed components.
@robertkasza
robertkasza force-pushed the chore/dashboard-remove-forwardref branch from 0e5c2eb to e691f93 Compare November 25, 2026 11:02
@robertkasza
robertkasza enabled auto-merge (squash) November 25, 2026 11:02
@robertkasza
robertkasza merged commit 5531500 into main Nov 25, 2026
13 checks passed
@robertkasza
robertkasza deleted the chore/dashboard-remove-forwardref branch November 25, 2026 11:31
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.

3 participants