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

如果做打字机效果回复的 时候 #130

Open
RiverThrimp opened this issue Jan 19, 2024 · 3 comments
Open

如果做打字机效果回复的 时候 #130

RiverThrimp opened this issue Jan 19, 2024 · 3 comments

Comments

@RiverThrimp
Copy link

Version information (版本信息)

  • ChatUI
  • ChatUI :2.4.2
  • React Version : 17.0.2
  • OS Version macOS : 12.2.1
  • Browser Version: 版本 120.0.6099.216(正式版本) (arm64)

Describe the bug (描述问题)
当使用打字机效果更新当前的一条消息的时候 消息的计数逻辑会一直增加+1导致显示的消息数对不上

Steps To Reproduce (重现步骤)

  1. 新增一条消息 消息的内容最好是很长
  2. 缩小当前的对话框 让滚动条出现 然后
  3. 将滚动条拉到最顶触发出回到底部的提醒
  4. 更新上一条新增的数据就会看到1条未读再更新就会出现2条未读

查看源码逻辑是这儿有问题
image

Link to minimal reproduction (最小化重现链接)
codesandbox 的链接地址 为 https://codesandbox.io/p/sandbox/chatui-demo-forked-fsy89q?file=%2Fsrc%2FApp.js%3A57%2C22
Expected behavior (期望的结果是什么)
期望可以正常更新 当前的消息数是按照消息的条数来更新的不是更新了原来的数据内容而导致计数 逻辑上不成立

@RiverThrimp
Copy link
Author

辛苦大佬关注一下这个问题 🙏🙏

@littleFutureGo
Copy link

+1,有遇到过这个问题

@RiverThrimp
Copy link
Author

image
这里将lastMessage 换成 messages.length 就可以了

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

2 participants