Skip to content

refactor: Remove deprecated react api usage#2034

Merged
mfortman11 merged 7 commits into
mainfrom
deprecated-react-apis
Jul 14, 2026
Merged

refactor: Remove deprecated react api usage#2034
mfortman11 merged 7 commits into
mainfrom
deprecated-react-apis

Conversation

@mfortman11

@mfortman11 mfortman11 commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

no-react19-deprecated-apis

  • 6 context files — useContextuse() (auth-context, brand-context, chat-context, knowledge-filter-context, task-context, banner)
  • 13 UI component files — removed forwardRef wrappers, ref is now a regular prop (accordion, avatar, button, card, command, dialog, dropdown-menu, input, popover, scroll-area, select, separator, slider, switch, tabs, tooltip)
  • 1 app component — chat-input.tsx

Summary by CodeRabbit

  • Refactor
    • Updated shared UI components to modernize ref handling while keeping the same visuals and user interactions across buttons, dialogs, menus, cards, inputs, and more.
    • Switched several context consumers to React’s use approach for consistent, modern state access.
  • Bug Fixes
    • Improved cloud connector availability detection to be more defensive when expected connector data is missing.

@github-actions github-actions Bot added community frontend 🟨 Issues related to the UI/UX and removed community labels Jul 6, 2026
@mfortman11 mfortman11 changed the title Deprecated react apis refactor: Remove deprecated react api usage Jul 6, 2026
@coderabbitai

coderabbitai Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: b599ee6d-bd51-415c-a541-a8429b2918ba

📥 Commits

Reviewing files that changed from the base of the PR and between 42ee0f2 and 6b6038e.

📒 Files selected for processing (1)
  • frontend/components/knowledge-dropdown.tsx

Walkthrough

This PR migrates frontend UI components from forwardRef to explicit ref props, removes component displayName assignments, replaces useContext with React’s use hook, and makes cloud connector lookup tolerate missing entries.

Changes

React component and context modernization

Layer / File(s) Summary
ChatInput ref handling
frontend/app/chat/_components/chat-input.tsx
ChatInput accepts an explicit ref prop while retaining its imperative handle methods.
Layout primitive ref migration
frontend/components/ui/{accordion,avatar,card,separator,scroll-area}.tsx
Layout components destructure refs from props and pass them to their underlying elements or Radix primitives.
Form control ref migration
frontend/components/ui/{button,input,slider,switch}.tsx
Form controls use function components with props-based ref handling while preserving existing rendering and interaction logic.
Overlay ref migration
frontend/components/ui/{dialog,popover,tooltip}.tsx
Overlay wrappers replace forwardRef implementations while retaining portal, content, and styling behavior.
Menu and navigation ref migration
frontend/components/ui/{command,dropdown-menu,select,tabs}.tsx
Menu and navigation wrappers pass refs through function component props.
Context consumption migration
frontend/components/ui/banner.tsx, frontend/contexts/*.tsx
Context consumers replace useContext with use while retaining existing guards and returned values.
Defensive connector lookup
frontend/components/knowledge-dropdown.tsx
Cloud connector initialization uses optional chaining and fallback values for missing connector data.

Estimated code review effort: 4 (Complex) | ~45 minutes

Possibly related PRs

Suggested reviewers: wallgau, ricofurtado, lucaseduoli, mpawlow

🚥 Pre-merge checks | ✅ 4 | ❌ 1

❌ Failed checks (1 warning)

Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (4 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately summarizes the main change: removing deprecated React API usage across the codebase.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.
✨ Finishing Touches
📝 Generate docstrings
  • Create stacked PR
  • Commit on current branch
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch deprecated-react-apis

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

@github-actions

github-actions Bot commented Jul 6, 2026

Copy link
Copy Markdown
Contributor

React Doctor found 1 new issue in 1 file · 1 warning · score 73 / 100 (Needs work) · 7 fixed · vs main

1 warning

app/chat/_components/chat-input.tsx

  • ⚠️ L52 Large component is hard to read and change no-giant-component

Reviewed by React Doctor for commit 9b66cc8. See inline comments for fixes.

@github-actions github-actions Bot added refactor and removed refactor labels Jul 6, 2026

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (1)
frontend/app/knowledge/page.tsx (1)

794-800: 🚀 Performance & Scalability | 🔵 Trivial | 💤 Low value

Redundant invalidate + refetch for the same query keys.

invalidateQueries defaults to refetchType: "active", so it already refetches active search/listFiles queries and its returned promise resolves only after those refetches settle. Pairing each invalidateQueries with a refetchQueries on the same key is redundant. You can drop the explicit refetchQueries calls, or use refetchType: "none" on the invalidations if the intent is to invalidate-then-refetch explicitly.

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In `@frontend/app/knowledge/page.tsx` around lines 794 - 800, The `Promise.all`
block in `knowledge/page.tsx` is doing redundant cache work for the same
`search` and `listFiles` keys: `queryClient.invalidateQueries` already triggers
active refetches and waits for them, so the matching `refetchQueries` calls
should be removed. Update the logic around `refreshTasks`, `invalidateQueries`,
and `refetchQueries` so each query key is handled only once, or switch the
invalidations to `refetchType: "none"` if you want to keep an explicit
invalidate-then-refetch flow.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Inline comments:
In `@frontend/components/knowledge-dropdown.tsx`:
- Around line 246-257: The handling of `connectorsResult.connectors` in
`knowledge-dropdown.tsx` is missing the same null-safe guard used elsewhere,
which can throw when the `/api/connectors` payload omits `connectors`. Update
the `availableTypes` filter and the `connectorInfo` population loop to use
optional chaining on `connectorsResult.connectors` and its indexed entries,
matching the existing access pattern around the connector type checks. This
should be fixed in the logic that builds `availableTypes` and fills
`connectorInfo` so the dropdown degrades safely when connector data is absent.

---

Nitpick comments:
In `@frontend/app/knowledge/page.tsx`:
- Around line 794-800: The `Promise.all` block in `knowledge/page.tsx` is doing
redundant cache work for the same `search` and `listFiles` keys:
`queryClient.invalidateQueries` already triggers active refetches and waits for
them, so the matching `refetchQueries` calls should be removed. Update the logic
around `refreshTasks`, `invalidateQueries`, and `refetchQueries` so each query
key is handled only once, or switch the invalidations to `refetchType: "none"`
if you want to keep an explicit invalidate-then-refetch flow.
🪄 Autofix (Beta)

Fix all unresolved CodeRabbit comments on this PR:

  • Push a commit to this branch (recommended)
  • Create a new PR with the fixes

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Pro

Run ID: c316934a-1011-4f2e-acca-7bffdfd696ca

📥 Commits

Reviewing files that changed from the base of the PR and between 857521d and 3396b20.

📒 Files selected for processing (26)
  • frontend/app/chat/_components/chat-input.tsx
  • frontend/app/knowledge/page.tsx
  • frontend/components/dev-role-toggle.tsx
  • frontend/components/knowledge-dropdown.tsx
  • frontend/components/ui/accordion.tsx
  • frontend/components/ui/avatar.tsx
  • frontend/components/ui/banner.tsx
  • frontend/components/ui/button.tsx
  • frontend/components/ui/card.tsx
  • frontend/components/ui/command.tsx
  • frontend/components/ui/dialog.tsx
  • frontend/components/ui/dropdown-menu.tsx
  • frontend/components/ui/input.tsx
  • frontend/components/ui/popover.tsx
  • frontend/components/ui/scroll-area.tsx
  • frontend/components/ui/select.tsx
  • frontend/components/ui/separator.tsx
  • frontend/components/ui/slider.tsx
  • frontend/components/ui/switch.tsx
  • frontend/components/ui/tabs.tsx
  • frontend/components/ui/tooltip.tsx
  • frontend/contexts/auth-context.tsx
  • frontend/contexts/brand-context.tsx
  • frontend/contexts/chat-context.tsx
  • frontend/contexts/knowledge-filter-context.tsx
  • frontend/contexts/task-context.tsx

Comment thread frontend/components/knowledge-dropdown.tsx
@mfortman11

Copy link
Copy Markdown
Contributor Author

Don't sweat the on React-doctor comments we're focussing on one for now

@Wallgau Wallgau left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Niiice!

@github-actions github-actions Bot added the lgtm label Jul 13, 2026
// Fetch all filters once when dropdown opens
const { data: allFilters = [] } = useGetAllFiltersQuery({
enabled: isFilterDropdownOpen,
export function ChatInput({

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

React Doctor · react-doctor/no-giant-component (warning)

Component "ChatInput" is 591 lines long, which is hard to read & change. Split it into a few smaller components.

Fix → Pull each section into its own component so the parent is easier to read, test, and change.

Docs

@mfortman11
mfortman11 merged commit bc82542 into main Jul 14, 2026
29 checks passed
@github-actions
github-actions Bot deleted the deprecated-react-apis branch July 14, 2026 20:53
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

frontend 🟨 Issues related to the UI/UX lgtm refactor

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants