Skip to content

Reapply "chore: upgrat de React 17 to React 18" - #2210

Merged
jsers merged 4 commits into
mainfrom
chore-reapply-react-18-main
Aug 3, 2026
Merged

Reapply "chore: upgrat de React 17 to React 18"#2210
jsers merged 4 commits into
mainfrom
chore-reapply-react-18-main

Conversation

@jsers

@jsers jsers commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

This reverts commit cd44fa3.

Summary by CodeRabbit

  • New Features
    • Upgraded the application to React 18 for improved rendering performance and compatibility.
  • Bug Fixes
    • Improved modal, chart annotation, and tooltip rendering and cleanup.
    • Ensured query history values and error messages display consistently as text.
    • Improved form and operation modal rendering reliability.
    • Preserved page styling during task output loading.
  • Compatibility
    • Improved compatibility across drag-and-drop controls, forms, inputs, and forwarded component references.

@coderabbitai

coderabbitai Bot commented Jul 23, 2026

Copy link
Copy Markdown

Review Change Stack

Caution

Review failed

The pull request is closed.

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro Plus

Run ID: 48dc0212-a455-4567-a992-298d70477746

📥 Commits

Reviewing files that changed from the base of the PR and between f54c1b6 and cba99d0.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (25)
  • package.json
  • src/components/ModalHOC.tsx
  • src/main.tsx
  • src/pages/alertRules/FormNG/components/TestFireModal/index.tsx
  • src/pages/dashboard/Components/ModalHOC.tsx
  • src/pages/dashboard/Renderer/Renderer/TimeSeriesNG/Main.tsx
  • src/pages/embeddedProduct/pages/List/index.tsx
  • src/pages/explorer/Elasticsearch/QueryBuilder.tsx
  • src/pages/explorer/Loki/component/context/index.tsx
  • src/pages/explorer/Loki/index.tsx
  • src/pages/hosts/pages/List/OperationModal.tsx
  • src/pages/log/IndexPatterns/index.tsx
  • src/pages/logExplorer/components/LogsViewer/components/LogFieldValue/Token.tsx
  • src/pages/targets/index.tsx
  • src/pages/taskOutput/host.jsx
  • src/pages/taskOutput/index.jsx
  • src/pages/user/component/businessForm/index.tsx
  • src/pages/user/component/passwordForm/index.tsx
  • src/pages/user/component/teamForm/index.tsx
  • src/pages/user/component/userForm/index.tsx
  • src/plugins/clickHouse/ExplorerNG/components/QueryInputAddonAfter.tsx
  • src/plugins/doris/Explorer/Query/index.tsx
  • src/plugins/doris/ExplorerNG/components/QueryInputAddonAfter.tsx
  • src/plugins/elasticsearch/ExplorerNG/components/QueryInputAddonAfter.tsx
  • src/types/react18-fixes.d.ts

📝 Walkthrough

Walkthrough

The project upgrades React and its type definitions to version 18, migrates application, modal, and chart rendering to createRoot, adds compatibility declarations, and adjusts affected TypeScript call sites.

Changes

React 18 migration

Layer / File(s) Summary
React 18 dependencies and compatibility contracts
package.json, src/types/react18-fixes.d.ts
React packages and related libraries are upgraded. React 18 compatibility declarations are added for third-party components.
Application and modal root migration
src/main.tsx, src/components/ModalHOC.tsx, src/pages/dashboard/Components/ModalHOC.tsx
Application and modal rendering use createRoot. Modal roots are explicitly unmounted during destruction.
Chart annotation root lifecycle
src/pages/dashboard/Renderer/Renderer/TimeSeriesNG/Main.tsx
Tooltip and marker roots are cached by DOM node and unmounted when the chart is deleted.
React 18 callsite and typing adjustments
src/pages/embeddedProduct/..., src/pages/log/..., src/pages/user/..., src/plugins/..., src/pages/hosts/..., src/pages/targets/index.tsx, src/pages/taskOutput/..., src/pages/alertRules/..., src/pages/explorer/...
Component ref types, rendered values, error arguments, fragments, lifecycle methods, and callback return types are adjusted for updated React typings.

Estimated code review effort: 3 (Moderate) | ~25 minutes

Possibly related PRs

  • n9e/fe#2172: Shares the React 17-to-18 upgrade and overlapping rendering and typing changes.
  • n9e/fe#2208: Modifies the same React dependencies, rendering APIs, and compatibility declarations.
  • n9e/fe#2134: Modifies the same operation-modal JSX structure.

Suggested reviewers: guguji5

✨ 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 chore-reapply-react-18-main

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.

jsers added 3 commits July 24, 2026 21:20
Bump ansi-to-react to ^6.2.6 and react-highlight-words to ^0.21.0.
Add react-sortable-hoc override to resolve React 18 peer dependency
warning. Fix t() return type in TestFireModal for strict TypeScript.
Wrap value with String() to ensure non-string types render correctly
in JSX without React warnings.
@jsers
jsers marked this pull request as ready for review August 3, 2026 02:36
Copilot AI review requested due to automatic review settings August 3, 2026 02:36
@jsers
jsers merged commit 2bc2b57 into main Aug 3, 2026
2 checks passed

Copilot AI 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.

🟡 Not ready to approve

Several updated typings (notably forwardRef<any> and err as string) weaken type-safety and do not reliably fix runtime behavior, and should be corrected before approval.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

This review doesn't count toward merge requirements. Sign up for the private preview to control whether Copilot approvals count.

Pull request overview

This PR reapplies the previously reverted React 17 → React 18 upgrade, updating runtime rendering APIs and introducing TypeScript compatibility patches to address stricter React 18 typings across the codebase.

Changes:

  • Upgrade React/ReactDOM and related typings to React 18, and migrate ReactDOM.render/unmountComponentAtNode usage to createRoot.
  • Add a React 18 type-compatibility .d.ts patch file to reduce third‑party type friction (e.g., draggable/sortable/antd).
  • Apply targeted TS/JSX adjustments (stringifying displayed values, minor typing tweaks) to satisfy stricter checks.
File summaries
File Description
src/types/react18-fixes.d.ts Adds module-augmentation type patches for React 18 compatibility with several third-party libs.
src/plugins/elasticsearch/ExplorerNG/components/QueryInputAddonAfter.tsx Stringifies displayed historical-record values to satisfy React 18 typing/render constraints.
src/plugins/doris/ExplorerNG/components/QueryInputAddonAfter.tsx Stringifies displayed historical-record values.
src/plugins/doris/Explorer/Query/index.tsx Stringifies displayed historical-record values.
src/plugins/clickHouse/ExplorerNG/components/QueryInputAddonAfter.tsx Stringifies displayed historical-record values.
src/pages/user/component/userForm/index.tsx Adjusts forwardRef typing during React 18 migration.
src/pages/user/component/teamForm/index.tsx Adjusts forwardRef typing during React 18 migration.
src/pages/user/component/passwordForm/index.tsx Adjusts forwardRef typing during React 18 migration.
src/pages/user/component/businessForm/index.tsx Adjusts forwardRef typing during React 18 migration.
src/pages/taskOutput/index.jsx Removes legacy componentWillMount usage (React 18 strictness).
src/pages/taskOutput/host.jsx Removes legacy componentWillMount usage (React 18 strictness).
src/pages/targets/index.tsx Wraps siblings in a fragment / adjusts conditional rendering for React 18 TS checks.
src/pages/logExplorer/components/LogsViewer/components/LogFieldValue/Token.tsx Narrows getPopupContainer return type to satisfy typings.
src/pages/log/IndexPatterns/index.tsx Tweaks SortableHandle typing for React 18 compatibility.
src/pages/hosts/pages/List/OperationModal.tsx Wraps siblings in a fragment / adjusts conditional rendering for React 18 TS checks.
src/pages/explorer/Loki/index.tsx Adjusts error handling typing for React 18/TS stricter checks.
src/pages/explorer/Loki/component/context/index.tsx Adjusts error handling typing for React 18/TS stricter checks.
src/pages/explorer/Elasticsearch/QueryBuilder.tsx Stringifies displayed cached-query values to satisfy React 18 constraints.
src/pages/embeddedProduct/pages/List/index.tsx Tweaks SortableHandle typing for React 18 compatibility.
src/pages/dashboard/Renderer/Renderer/TimeSeriesNG/Main.tsx Migrates uPlot tooltip/marker rendering to createRoot and manages roots.
src/pages/dashboard/Components/ModalHOC.tsx Migrates modal rendering from legacy ReactDOM APIs to createRoot.
src/pages/alertRules/FormNG/components/TestFireModal/index.tsx Tightens translation helper return typing for TS compatibility.
src/main.tsx Migrates app bootstrap from ReactDOM.render to createRoot.
src/components/ModalHOC.tsx Migrates modal rendering from legacy ReactDOM APIs to createRoot.
package.json Upgrades React/ReactDOM and related packages; adds overrides for dependency alignment.
Review details
  • Files reviewed: 24/26 changed files
  • Comments generated: 6
  • Review effort level: Lite

We're testing this review assessment. Please use 👍 or 👎 to tell us if it's correct.


const { Option } = Select;
const UserForm = React.forwardRef<ReactNode, UserAndPasswordFormProps>((props, ref) => {
const UserForm = React.forwardRef<any, UserAndPasswordFormProps>((props, ref) => {
import { CommonStateContext } from '@/App';

const TeamForm = React.forwardRef<ReactNode, TeamProps>((props, ref) => {
const TeamForm = React.forwardRef<any, TeamProps>((props, ref) => {
import { UserAndPasswordFormProps } from '@/store/manageInterface';
import { useTranslation } from 'react-i18next';
const PasswordForm = React.forwardRef<ReactNode, UserAndPasswordFormProps>((props, ref) => {
const PasswordForm = React.forwardRef<any, UserAndPasswordFormProps>((props, ref) => {

const { Option } = Select;
const TeamForm = React.forwardRef<ReactNode, TeamProps>((props, ref) => {
const TeamForm = React.forwardRef<any, TeamProps>((props, ref) => {
Comment on lines 187 to 189
} catch (err) {
message.error(err);
message.error(err as string);
} finally {
Comment on lines 63 to 65
} catch (err) {
message.error(err);
message.error(err as string);
} finally {
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