Skip to content

Revert "chore: upgrade React 17 to React 18" - #2208

Merged
jsers merged 1 commit into
mainfrom
revert-2172-chore-upgrade-react-18
Jul 23, 2026
Merged

Revert "chore: upgrade React 17 to React 18"#2208
jsers merged 1 commit into
mainfrom
revert-2172-chore-upgrade-react-18

Conversation

@jsers

@jsers jsers commented Jul 23, 2026

Copy link
Copy Markdown
Collaborator

Reverts #2172

Summary by CodeRabbit

  • Compatibility

    • Updated the application to use React 17 and compatible type definitions.
    • Preserved rendering, modal, and embedded widget behavior with the supported React version.
  • Bug Fixes

    • Improved display of cached query values without unnecessary text conversion.
    • Improved error reporting and popup positioning in explorer and log views.
    • Applied consistent styling to task output pages.
  • Refactor

    • Simplified form rendering and strengthened type handling across several components.

@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: 9bc6f837-bfec-49f0-bf0e-36e1c6e526c4

📥 Commits

Reviewing files that changed from the base of the PR and between 8663c1f and cd44fa3.

⛔ Files ignored due to path filters (1)
  • package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (26)
  • package.json
  • src/components/ModalHOC.tsx
  • src/main.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/Explorer/Table.tsx
  • src/plugins/doris/Explorer/Query/index.tsx
  • src/plugins/doris/ExplorerNG/components/QueryInputAddonAfter.tsx
  • src/plugins/elasticsearch/ExplorerNG/components/QueryInputAddonAfter.tsx
  • src/plugins/mysql/Explorer/Table.tsx
  • src/plugins/pgsql/Explorer/Table.tsx
  • src/types/react18-fixes.d.ts

📝 Walkthrough

Walkthrough

React is downgraded from version 18 to 17, rendering switches to legacy ReactDOM APIs, React 18 compatibility declarations are removed, and several component typings, cached-value renderers, form conditions, error handlers, and page styles are adjusted.

Changes

React 17 compatibility

Layer / File(s) Summary
React 17 dependencies and mounting APIs
package.json, src/main.tsx, src/components/ModalHOC.tsx, src/pages/dashboard/Components/ModalHOC.tsx
React packages and typings target React 17, while application and modal rendering use ReactDOM.render and ReactDOM.unmountComponentAtNode.
Embedded chart rendering migration
src/pages/dashboard/Renderer/Renderer/TimeSeriesNG/Main.tsx
Tooltip and annotation overlays use ReactDOM.render, and tracked React root cleanup is removed.
TypeScript compatibility adjustments
src/types/react18-fixes.d.ts, src/pages/user/component/*, src/pages/embeddedProduct/pages/List/index.tsx, src/pages/log/IndexPatterns/index.tsx, src/plugins/*/Explorer/Table.tsx, src/pages/logExplorer/.../Token.tsx
React 18 module augmentations are removed and related component callback and forwarded-ref typings are adjusted.
UI rendering and lifecycle adjustments
src/pages/explorer/..., src/plugins/doris/..., src/plugins/elasticsearch/..., src/pages/hosts/..., src/pages/targets/index.tsx, src/pages/taskOutput/*
Cached values render directly, errors pass through without string casts, form conditions are simplified, and task output pages set body styles before mounting.

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

Possibly related PRs

  • n9e/fe#2172: Related React version and ReactDOM mounting API migration in overlapping application areas.

Suggested reviewers: copilot, 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 revert-2172-chore-upgrade-react-18

Warning

There were issues while running some tools. Please review the errors and either fix the tool's configuration or disable the tool if it's a critical failure.

🔧 Checkov (3.3.8)
package.json

Traceback (most recent call last):
File "/usr/local/bin/checkov", line 2, in
from checkov.main import Checkov
ModuleNotFoundError: No module named 'checkov'


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
jsers marked this pull request as ready for review July 23, 2026 07:10
Copilot AI review requested due to automatic review settings July 23, 2026 07:10
@jsers
jsers merged commit a24764d into main Jul 23, 2026
1 of 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.

Pull request overview

This PR reverts the prior React 18 upgrade (#2172), downgrading the app back to React 17 and undoing React 18–specific runtime and typing adjustments across the codebase.

Changes:

  • Downgrade react, react-dom, and corresponding @types/* packages back to React 17.
  • Replace React 18 createRoot usage with React 17 ReactDOM.render/unmountComponentAtNode in app bootstrap and modal helpers.
  • Remove/adjust React 18–driven type and JSX changes across several pages/plugins.

Reviewed changes

Copilot reviewed 25 out of 27 changed files in this pull request and generated 12 comments.

Show a summary per file
File Description
src/types/react18-fixes.d.ts Removes React 18 compatibility type augmentations.
src/plugins/pgsql/Explorer/Table.tsx Removes explicit any from tooltip render callback (revert typing tweaks).
src/plugins/mysql/Explorer/Table.tsx Same tooltip render typing tweak revert.
src/plugins/clickHouse/Explorer/Table.tsx Same tooltip render typing tweak revert.
src/plugins/elasticsearch/ExplorerNG/components/QueryInputAddonAfter.tsx Adjusts rendered historical-record values (revert React 18-driven stringification).
src/plugins/doris/ExplorerNG/components/QueryInputAddonAfter.tsx Same historical-record rendering adjustment.
src/plugins/doris/Explorer/Query/index.tsx Same historical-record rendering adjustment.
src/pages/user/component/userForm/index.tsx Ref typing change related to React 17/18 typing differences.
src/pages/user/component/teamForm/index.tsx Ref typing change related to React 17/18 typing differences.
src/pages/user/component/passwordForm/index.tsx Ref typing change related to React 17/18 typing differences.
src/pages/user/component/businessForm/index.tsx Ref typing change related to React 17/18 typing differences.
src/pages/taskOutput/index.jsx Adds a legacy lifecycle hook to set body styles (React version related).
src/pages/taskOutput/host.jsx Same body-style lifecycle adjustment.
src/pages/targets/index.tsx Removes fragment wrapper and adjusts conditional rendering (JSX typing workaround removal).
src/pages/logExplorer/components/LogsViewer/components/LogFieldValue/Token.tsx Adjusts popup container typing to align with older React typings.
src/pages/log/IndexPatterns/index.tsx Adjusts SortableHandle typing to align with older React typings.
src/pages/hosts/pages/List/OperationModal.tsx Removes fragment wrapper and adjusts conditional rendering (JSX typing workaround removal).
src/pages/explorer/Loki/index.tsx Error handling change in message.error call.
src/pages/explorer/Loki/component/context/index.tsx Error handling change in message.error call.
src/pages/explorer/Elasticsearch/QueryBuilder.tsx Adjusts historical-record rendering to avoid React 18-only stringification.
src/pages/embeddedProduct/pages/List/index.tsx Adjusts SortableHandle typing to align with older React typings.
src/pages/dashboard/Renderer/Renderer/TimeSeriesNG/Main.tsx Replaces createRoot with ReactDOM.render in uPlot plugin render targets.
src/pages/dashboard/Components/ModalHOC.tsx Reverts modal mounting from createRoot to ReactDOM.render + unmount.
src/components/ModalHOC.tsx Reverts modal mounting from createRoot to ReactDOM.render + unmount.
src/main.tsx Reverts app bootstrap from createRoot to ReactDOM.render.
package.json Downgrades React and React DOM (+ types) to React 17.


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

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

const { Option } = Select;
const TeamForm = React.forwardRef<any, TeamProps>((props, ref) => {
const TeamForm = React.forwardRef<ReactNode, TeamProps>((props, ref) => {
Comment on lines +23 to +26
componentWillMount = () => {
document.body.style.backgroundColor = '#f0f2f5';
document.body.style.color = 'rgba(0, 0, 0, 0.65)';
};
Comment on lines 36 to 40
function destroy() {
root.unmount();
if (div.parentNode) {
const unmountResult = ReactDOM.unmountComponentAtNode(div);
if (unmountResult && div.parentNode) {
div.parentNode.removeChild(div);
}
Comment thread src/main.tsx
<I18nextProvider i18n={i18nInit}>
<App />
</I18nextProvider>,
document.getElementById('root'),
}
} catch (err) {
message.error(err as string);
message.error(err);
setData(_.concat(parseResponse(res2.result || []).dataRows, parseResponse(res1.result || []).dataRows));
} catch (err) {
message.error(err as string);
message.error(err);
Comment on lines 355 to 357
onDelete={(id) => {
uplotsMap.delete(id);
rootRefs.current.forEach((r) => r.unmount());
rootRefs.current.clear();
}}
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