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

fix: 兼容在 React 19 环境下的 Toast 组件 #6774

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lujun2
Copy link

@lujun2 lujun2 commented Nov 1, 2024

Close #6635

Copy link
Contributor

github-actions bot commented Nov 1, 2024

Preview is ready

Copy link

codecov bot commented Nov 1, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.70%. Comparing base (2a70c91) to head (1300225).
Report is 5 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #6774   +/-   ##
=======================================
  Coverage   92.70%   92.70%           
=======================================
  Files         335      335           
  Lines        7199     7200    +1     
  Branches     1767     1768    +1     
=======================================
+ Hits         6674     6675    +1     
  Misses        517      517           
  Partials        8        8           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -1,6 +1,6 @@
import type { ReactElement } from 'react'
import * as ReactDOM from 'react-dom'
import type { Root } from 'react-dom/client'
import { type Root, createRoot as createClientRoot } from 'react-dom/client'
Copy link
Member

Choose a reason for hiding this comment

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

这么写 React 16 会挂掉

Copy link
Author

Choose a reason for hiding this comment

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

@zombieJ 已改为 conditional import

// eslint-disable-next-line @typescript-eslint/no-var-requires
createRoot = fullClone.createRoot
const { createRoot: createRootV18 } = require('react-dom/client')
Copy link
Member

Choose a reason for hiding this comment

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

这样也没用,webpack 编译时也会报错。在 antd 侧也有一样的问题,这个只能通过发大版本把旧版本的 react 支持废弃掉才行。

@Me-UserName
Copy link

这个能否尽快发个版啊,同样遇到这个问题了

@zsh1111111111111
Copy link

版本发了吗?为什么还是不行啊

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.

React 19 RC react-dom 不再导出 createRoot
4 participants