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

[message] 在多次调用messagePlugin方法的场景下,它返回的promise中的实例总是指向最后一次调用的实例 #3488

Open
maoyiluo opened this issue Feb 10, 2025 · 1 comment
Labels
🐞 bug Something isn't working

Comments

@maoyiluo
Copy link
Collaborator

tdesign-vue 版本

1.10.9

重现链接

https://stackblitz.com/edit/nkriumlb-5vtsmhlx?file=src%2Fdemo.vue

重现步骤

可参考👇的链接,点击“无限加载中”后点击“关闭无限加载”,会发现messagePlugin.loading返回的promise中的instance指向了后面创建的success

Image

期望结果

预期结果是关闭loading message

实际结果

关闭了后面调用的success message

框架版本

No response

浏览器版本

No response

系统版本

No response

Node版本

No response

补充说明

return new Promise((resolve) => {
    const ins = instanceMap.get(attachDom)[placement];
    ins.$nextTick(() => {
      const msg: Array<MessageInstance> = ins.$children;
      resolve(msg[msg.length - 1]);
    });
  });

我查看了messagePlugin的代码实现,发现返回的promise返回的是最新的element而不是实际调用的时候创建的element,好奇这个是by Design还是bug,如果是bug,我愿意提交修复PR

Copy link
Contributor

👋 @maoyiluo,感谢给 TDesign 提出了 issue。
请根据 issue 模版确保背景信息的完善,我们将调查并尽快回复你。

@uyarn uyarn added the 🐞 bug Something isn't working label Feb 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐞 bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants