-
Notifications
You must be signed in to change notification settings - Fork 795
fix: [Toast][Notification] Fixed a TypeError issue that occurred on the first Toast/Notification imperative call in React v19 #3053
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
Conversation
…he first Toast/Notification imperative call in React v19
e7f46d1 to
e39ff79
Compare
|
This pull request is automatically built and testable in CodeSandbox. To see build info of the built libraries, click here or the icon next to each commit SHA. Latest deployment of this branch, based on commit 94700d4:
|
semi-design
|
||||||||||||||||||||||||||||||
| Project |
semi-design
|
| Branch Review |
fix/19-toast
|
| Run status |
|
| Run duration | 08m 20s |
| Commit |
|
| Committer | YyumeiZhang |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
13
|
|
|
0
|
|
|
291
|
Upgrade your plan to view test results. | |
| View all changes introduced in this branch ↗︎ | |
packages/semi-ui/toast/index.tsx
Outdated
| }; | ||
|
|
||
| /* REACT_19_START */ | ||
| // const toastQueue: Array<{ opts: ToastReactProps, id: string }> = []; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Toast 支持通过 ToastFactory.create 来在应用中设置不同 config 的 Toast,目前 toastQueue 定义在全局,生成的所有的 ToastList 类都会共享同一个 queue 数组,会出现抢占同一个 queue 的情况发生,把 queue 添加在 ToastList 的静态属性是更合适些,这样不同的 Toast 实例只会消费自己的 queue ,互不干扰。
…he first Toast/Notification imperative call in React v19
semi-design
|
||||||||||||||||||||||||||||||
| Project |
semi-design
|
| Branch Review |
main
|
| Run status |
|
| Run duration | 08m 16s |
| Commit |
|
| Committer | YyumeiZhang |
| View all properties for this run ↗︎ | |
| Test results | |
|---|---|
|
|
0
|
|
|
0
|
|
|
13
|
|
|
0
|
|
|
291
|
Upgrade your plan to view test results. | |
| View all changes introduced in this branch ↗︎ | |
中文模板 / Chinese Template
What kind of change does this PR introduce? (check at least one)
PR description
Fixes #2743
复现版本:2.88.3
复现代码
虽然 react v19 中,root.render 是同步调用,但是并不意味中被渲染的元素的 ref 方法调用也是同步的, Toast 和 Notification 中都有下面的逻辑
因此 TypeError。
修复思路
在 saveRef 还没赋值时,先缓存需要调用的方法的 props,待 ref 方法调用,再使用 props 去调用方法
Changelog
🇨🇳 Chinese
🇺🇸 English
Checklist
Other
Additional information