Skip to content

chore(new-webui): Add compatibility patch for Ant Design with React 19.#933

Merged
junhaoliao merged 1 commit into
mainfrom
antd-compat
May 28, 2025
Merged

chore(new-webui): Add compatibility patch for Ant Design with React 19.#933
junhaoliao merged 1 commit into
mainfrom
antd-compat

Conversation

@junhaoliao

@junhaoliao junhaoliao commented May 28, 2025

Copy link
Copy Markdown
Member

Description

As instructed by https://ant.design/docs/react/v5-for-19 , add compatibility patch for Ant Design with React 19.

Checklist

  • The PR satisfies the contribution guidelines.
  • This is a breaking change and that has been indicated in the PR title, OR this isn't a
    breaking change.
  • Necessary docs have been updated, OR no docs need to be updated.

Validation performed

  1. Modified AntApp in components/log-viewer-webui/client/src/AntdApp.tsx as
    import {message} from "antd";
    ...
    const AntApp = () => {
        useEffect(() => {
            message.error("hi");
        }, []);
    
        return <RouterProvider router={router}/>;
    };
    
    and observed two error pop-ups showed up as shown in below screenshot. (two messages were rendered because of React StrictMode)
    image

Summary by CodeRabbit

  • Chores
    • Updated dependencies to improve compatibility with newer versions of React and Ant Design.

@junhaoliao junhaoliao requested a review from a team as a code owner May 28, 2025 18:47
@coderabbitai

coderabbitai Bot commented May 28, 2025

Copy link
Copy Markdown
Contributor

Walkthrough

A new dependency, @ant-design/v5-patch-for-react-19, was added to the package.json for the log viewer web UI client. An import statement for this patch was introduced at the top of AntdApp.tsx to ensure compatibility between Ant Design v5 and React 19. No other changes were made.

Changes

File(s) Change Summary
.../log-viewer-webui/client/package.json Added @ant-design/v5-patch-for-react-19 dependency; reordered react-chartjs-2 in the list.
.../log-viewer-webui/client/src/AntdApp.tsx Added import of @ant-design/v5-patch-for-react-19 at the top of the file.

Possibly related PRs

Suggested reviewers

  • davemarco
✨ Finishing Touches
  • 📝 Generate Docstrings

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
🪧 Tips

Chat

There are 3 ways to chat with CodeRabbit:

  • Review comments: Directly reply to a review comment made by CodeRabbit. Example:
    • I pushed a fix in commit <commit_id>, please review it.
    • Explain this complex logic.
    • Open a follow-up GitHub issue for this discussion.
  • Files and specific lines of code (under the "Files changed" tab): Tag @coderabbitai in a new review comment at the desired location with your query. Examples:
    • @coderabbitai explain this code block.
    • @coderabbitai modularize this function.
  • PR comments: Tag @coderabbitai in a new PR comment to ask questions about the PR branch. For the best results, please provide a very specific query, as very limited context is provided in this mode. Examples:
    • @coderabbitai gather interesting stats about this repository and render them as a table. Additionally, render a pie chart showing the language distribution in the codebase.
    • @coderabbitai read src/utils.ts and explain its main purpose.
    • @coderabbitai read the files in the src/scheduler package and generate a class diagram using mermaid and a README in the markdown format.
    • @coderabbitai help me debug CodeRabbit configuration file.

Support

Need help? Create a ticket on our support page for assistance with any issues or questions.

Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments.

CodeRabbit Commands (Invoked using PR comments)

  • @coderabbitai pause to pause the reviews on a PR.
  • @coderabbitai resume to resume the paused reviews.
  • @coderabbitai review to trigger an incremental review. This is useful when automatic reviews are disabled for the repository.
  • @coderabbitai full review to do a full review from scratch and review all the files again.
  • @coderabbitai summary to regenerate the summary of the PR.
  • @coderabbitai generate docstrings to generate docstrings for this PR.
  • @coderabbitai generate sequence diagram to generate a sequence diagram of the changes in this PR.
  • @coderabbitai resolve resolve all the CodeRabbit review comments.
  • @coderabbitai configuration to show the current CodeRabbit configuration for the repository.
  • @coderabbitai help to get help.

Other keywords and placeholders

  • Add @coderabbitai ignore anywhere in the PR description to prevent this PR from being reviewed.
  • Add @coderabbitai summary to generate the high-level summary at a specific location in the PR description.
  • Add @coderabbitai anywhere in the PR title to generate the title automatically.

CodeRabbit Configuration File (.coderabbit.yaml)

  • You can programmatically configure CodeRabbit by adding a .coderabbit.yaml file to the root of your repository.
  • Please see the configuration documentation for more information.
  • If your editor has YAML language server enabled, you can add the path at the top of this file to enable auto-completion and validation: # yaml-language-server: $schema=https://coderabbit.ai/integrations/schema.v2.json

Documentation and Community

  • Visit our Documentation for detailed information on how to use CodeRabbit.
  • Join our Discord Community to get help, request features, and share feedback.
  • Follow us on X/Twitter for updates and announcements.

@junhaoliao junhaoliao requested a review from davemarco May 28, 2025 18:47

@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: 2

📜 Review details

Configuration used: CodeRabbit UI
Review profile: ASSERTIVE
Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between cd48f8b and 6901c28.

⛔ Files ignored due to path filters (1)
  • components/log-viewer-webui/client/package-lock.json is excluded by !**/package-lock.json
📒 Files selected for processing (2)
  • components/log-viewer-webui/client/package.json (1 hunks)
  • components/log-viewer-webui/client/src/AntdApp.tsx (1 hunks)
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}`: - Prefer `false == ` rather than `!`.

**/*.{cpp,hpp,java,js,jsx,tpp,ts,tsx}: - Prefer false == <expression> rather than !<expression>.

  • components/log-viewer-webui/client/src/AntdApp.tsx
⏰ Context from checks skipped due to timeout of 90000ms (2)
  • GitHub Check: lint-check (macos-latest)
  • GitHub Check: lint-check (ubuntu-latest)
🔇 Additional comments (1)
components/log-viewer-webui/client/package.json (1)

17-17: Approve addition of React-19 compatibility patch
The dependency @ant-design/v5-patch-for-react-19@^1.0.3 is required to ensure Ant Design v5 works correctly with React 19 and matches the tested version.

"dayjs": "^1.11.13",
"highlight.js": "^11.11.1",
"react": "^19.0.0",
"react-chartjs-2": "^5.3.0",

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.

🧹 Nitpick (assertive)

Optional: Standardise dependency ordering
The moved react-chartjs-2 entry is valid, but consider organising dependencies alphabetically or grouping them by ecosystem for improved maintainability.

🤖 Prompt for AI Agents
In components/log-viewer-webui/client/package.json at line 30, the dependency
"react-chartjs-2" is correctly added but the dependencies list is not ordered
consistently. To improve maintainability, reorder all dependencies
alphabetically or group them logically by ecosystem. Adjust the entire
dependencies section to follow the chosen ordering scheme.


import router from "./router";

import "@ant-design/v5-patch-for-react-19";

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.

⚠️ Potential issue

Load the compatibility patch before all other imports
The side-effect import must execute prior to any React or component imports to properly patch Ant Design. Please relocate this line to the very top of the file.

- import {RouterProvider} from "react-router";
- import router from "./router";
- import "@ant-design/v5-patch-for-react-19";
+ import "@ant-design/v5-patch-for-react-19";
+ import {RouterProvider} from "react-router";
+ import router from "./router";
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
import "@ant-design/v5-patch-for-react-19";
import "@ant-design/v5-patch-for-react-19";
import {RouterProvider} from "react-router";
import router from "./router";
🤖 Prompt for AI Agents
In components/log-viewer-webui/client/src/AntdApp.tsx at line 5, the import of
the Ant Design compatibility patch must be moved to the very top of the file
before any other imports. This ensures the patch runs first and properly
modifies Ant Design behavior. Relocate the import statement so it is the first
line in the file.

@junhaoliao junhaoliao changed the title chore: Add compatibility patch for Ant Design with React 19. chore(new-webui): Add compatibility patch for Ant Design with React 19. May 28, 2025

@davemarco davemarco 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.

lgtm. title looks good.

@junhaoliao junhaoliao merged commit e864329 into main May 28, 2025
14 checks passed
@junhaoliao junhaoliao deleted the antd-compat branch May 28, 2025 20:49
@junhaoliao junhaoliao restored the antd-compat branch May 28, 2025 20:49
@junhaoliao junhaoliao deleted the antd-compat branch May 28, 2025 20:49
junhaoliao added a commit to junhaoliao/clp that referenced this pull request May 17, 2026
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