Widget: `data-welcome-bubble-delay="3s"` becomes a 3 ms delay

已关闭
#445 2 条评论 0 个 reaction 已指派 1 人 在 GitHub 查看

维护者通常 1 天内回复

@prakashNalla 已经在做这个了。

开始于 2026年10月28日。

  • #450 来自 @prakashNalla —— 已合并

评估

这个 Issue 还没有评估数据。

描述

Which part?

@chatcops/widget

Package version

dev

What happened?

data-welcome-bubble-delay is read with parseInt(value, 10) in packages/widget/src/script-config.ts (line 44), and the loader uses it as bubble.delay ?? DEFAULT_BUBBLE_DELAY (packages/widget/src/loader/loader.ts, line 226). So a value that isn't plain milliseconds doesn't fall back to the 3000 ms default:

data-welcome-bubble-delay delay used
"3000" 3000 ms
"3s" 3 ms
"1.5s" 1 ms
"soon" NaN, and ?? keeps it, so the bubble shows at once

The other numeric attributes in the same file (data-auto-open, data-history-ttl-days) only accept /^\d+$/ and give undefined otherwise, so they fall back to their defaults.

What did you expect?

The same check as the other attributes: digits only become the delay, anything else is undefined and the 3000 ms default applies. The docs say the value is in ms.

How can we reproduce it?
<script src=".../chatcops.min.js" data-api-url="/api/chat" data-welcome-bubble="Need help?" data-welcome-bubble-delay="3s"></script>

The bubble shows almost immediately instead of after 3 seconds. parseInt("3s", 10) is 3.

Environment

Read from the code on dev and checked the parsing in Node 22

主要语言
TypeScript
星标
13
派生
7
平均合并
3 小时 10 分钟
30 天内合并 PR
339

环境准备

从这里开始

  1. 先读完整个 Issue,再读项目的贡献指南。
  2. 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
  3. Fork 仓库,在一个分支上完成修改。
  4. 提交 Pull Request,并在描述里引用这个 Issue 编号。

codercops/chatcops 的其他 Issue

查看 codercops/chatcops 的全部 Issue

相似的 Issue

更多 TypeScript Issue

把新 issue 发到你的邮箱

精选适合新手参与的 GitHub issue 摘要。