Skip to content

Conversation

HaixingOoO
Copy link
Collaborator

🤔 这个 PR 的性质是?

  • 日常 bug 修复
  • 新特性提交
  • 文档改进
  • 演示代码改进
  • 组件样式/交互改进
  • CI/CD 改进
  • 重构
  • 代码风格优化
  • 测试用例
  • 分支合并
  • 其他

🔗 相关 Issue

💡 需求背景和解决方案

优化 Dialog 或 Portal 执行渲染时,子元素一些在 useLayoutEffect 或 useEffect 时,一些计算值时导致的异常问题;

在 Portal 的 useEffect 之后才渲染 children ;

📝 更新日志

  • refactor(Dialog): 优化 Dialog 和 Portal 的渲染阶段

  • 本条 PR 不需要纳入 Changelog

☑️ 请求合并前的自查清单

⚠️ 请自检并全部勾选全部选项⚠️

  • 文档已补充或无须补充
  • 代码演示已提供或无须提供
  • TypeScript 定义已补充或无须补充
  • Changelog 已提供或无须提供

Copy link
Contributor

@Copilot Copilot AI left a comment

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 optimizes the Dialog and Portal components to address rendering issues where child elements calculating values in useLayoutEffect or useEffect could cause exceptions. The solution delays rendering children in Portal until after useEffect execution.

  • Refactors Portal to use state-controlled mounting instead of immediate rendering
  • Optimizes Dialog animation and positioning logic with improved state management
  • Removes autofocus call from Textarea useEffect

Reviewed Changes

Copilot reviewed 3 out of 3 changed files in this pull request and generated 4 comments.

File Description
packages/components/common/Portal.tsx Implements delayed mounting pattern with state control to prevent child rendering issues
packages/components/dialog/Dialog.tsx Adds animation state management and mouse position tracking for better dialog positioning
packages/components/textarea/Textarea.tsx Removes handleAutoFocus call from useEffect dependency array

Copy link

pkg-pr-new bot commented Aug 3, 2025

tdesign-react-demo

npm i https://pkg.pr.new/tdesign-react@3705

commit: b24edd5

Copy link
Contributor

github-actions bot commented Aug 3, 2025

完成

@HaixingOoO HaixingOoO added the WIP work in porgess label Aug 3, 2025
@HaixingOoO HaixingOoO removed the WIP work in porgess label Aug 10, 2025
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