Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor: upgrade to react 18 #3171

Merged
merged 46 commits into from
Dec 7, 2023
Merged

Conversation

erha19
Copy link
Member

@erha19 erha19 commented Nov 16, 2023

Types

  • 🪚 Refactors

Background or solution

🤖[deprecated] Generated by Copilot at a7c746e

  • Add a global variable IS_REACT_ACT_ENVIRONMENT to indicate a React 18 concurrent mode environment (link)
  • Update the types and peer dependencies of React, React DOM, and React Is to version 18 (link, link, link)
  • Use the new React 18 client-only entry point and root API to enable concurrent mode features in the core-browser package (link, link, link, link)
  • Pass a callback function to the main and App components to invoke the didRendered callback from the app config instance when the BoxPanel component is rendered (link, link, link, link, link)
  • Modify the rendering of the comment body in the comments-item.view.tsx file to handle the case when the body is an object with a value property (link)
  • Modify the type guard functions and the event handler in the select/index.tsx file to support the new select API that allows grouping and customizing the options and to avoid conflicts with other event listeners (link, link, link)
  • Wrap the test actions that update the state of the comment service in the act function in the comment.service.test.ts file (link, link, link, link, link)
  • Modify the test data in the comment-thread.test.ts file to use a single comment body instead of multiple ones (link, link, link, link)
  • Annotate the props type of various components with the PropsWithChildren type to explicitly declare the children prop (link, link, link, link, link, link, link, link, link, link, link)
  • Remove the React.SFC type annotation from the return type of the createFromIconfontCN function in the iconfont-cn.tsx file (link)
  • Add the --legacy-peer-deps flag to the lerna.json file to avoid conflicts with the peer dependencies of React 18 and other packages (link)
  • Remove the assignment of the mocked monaco global variable, the empty beforeEach block, and some empty lines in the comment.service.test.ts file (link, link, link, link)
  • Modify the SlotDecorator component in the slot.tsx file to add the color, children, and backgroundColor props (link)
  • Increase the stack trace limit for debugging purposes in the comment.service.test.ts file (link)

ref: #861

Changelog

🤖[deprecated] Generated by Copilot at a7c746e

This pull request updates the codebase to use React 18 and its new features for concurrent mode and client-only rendering. It also improves the type safety, readability, and flexibility of various components and tests. It fixes some issues with the comment and select APIs and removes some deprecated or redundant code. It affects the files packages/comments/*, packages/components/*, packages/core-browser/*, jest.setup.jsdom.js, lerna.json, and package.json.

@erha19 erha19 changed the title refactor: upgrade to react 1 refactor: upgrade to react 18 Nov 16, 2023
@opensumi opensumi bot added the ⚙️ refactor Refactor code label Nov 16, 2023
@erha19 erha19 mentioned this pull request Nov 16, 2023
1 task
@opensumi opensumi bot added 🎨 feature feature required 🐞 bug Something isn't working labels Nov 16, 2023
@erha19 erha19 added the v3 OpenSumi 3.0 label Nov 16, 2023
@erha19 erha19 self-assigned this Nov 16, 2023
@erha19 erha19 force-pushed the refactor/upgrade-to-react-18-next branch from 41cea35 to 22c4547 Compare December 1, 2023 03:57
Ricbet
Ricbet previously approved these changes Dec 6, 2023
Copy link
Member

@Ricbet Ricbet left a comment

Choose a reason for hiding this comment

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

LGTM

lerna.json Outdated Show resolved Hide resolved
bytemain
bytemain previously approved these changes Dec 6, 2023
@erha19 erha19 dismissed stale reviews from bytemain and Ricbet via 9be7584 December 7, 2023 02:15
@erha19 erha19 merged commit 08dea33 into main Dec 7, 2023
11 checks passed
@erha19 erha19 deleted the refactor/upgrade-to-react-18-next branch December 7, 2023 05:47
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working 🎨 feature feature required ⚙️ refactor Refactor code v3 OpenSumi 3.0
Projects
Status: Done
Development

Successfully merging this pull request may close these issues.

4 participants