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

[BUG] Modal Hooks 无法update和destroy #2565

Open
1 task done
koderx opened this issue Nov 12, 2024 · 0 comments
Open
1 task done

[BUG] Modal Hooks 无法update和destroy #2565

koderx opened this issue Nov 12, 2024 · 0 comments

Comments

@koderx
Copy link

koderx commented Nov 12, 2024

Is there an existing issue for this?

  • I have searched the existing issues

Which Component

Modal

Semi Version

2.68.2

Current Behavior

image

const m = modal.confirm(config);
m.update({content: "new Content"})
m.destroy()

image
update和destroy没有生效

Expected Behavior

No response

Steps To Reproduce

https://semi.design/zh-CN/show/modal
修改useHooks下的代码 modal.confirm(config)

const m = modal.confirm(config);
m.update({content: "new Content"})
m.destroy()

ReproducibleCode

No response

Environment

- OS: Mac 15.0.1
- browser: Chrome 130.0.6723.117

Anything else?

看了应该是这里的ref绑定的问题,创建完立马调用update会因为没有绑定成功导致未执行
https://github.com/DouyinFE/semi-design/blob/main/packages/semi-ui/modal/useModal/index.tsx
image

把上面复现代码改成

const m = modal.confirm(config);
setTimeout(() => {m.update({content: "new Content"})}, 100)

就能更新了,但是很不优雅,会有闪动

@koderx koderx changed the title [BUG] Modal Hooks 无法update和destory [BUG] Modal Hooks 无法update和destroy Nov 12, 2024
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

No branches or pull requests

1 participant