Widget: `data-welcome-bubble-delay="3s"` becomes a 3 ms delay
维护者通常 1 天内回复
评估
这个 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
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 阅读贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
codercops/chatcops 的其他 Issue
-
documentation
难度 3/5 1-2 天 新手友好度 72/100
codercops/chatcops#555 · 1 条评论 ·
维护者通常 1 天内回复
-
难度 1/5 1 小时以内 新手友好度 25/100
codercops/chatcops#546 · 4 条评论 ·
维护者通常 1 天内回复
-
难度 3/5 1-2 天 新手友好度 64/100
codercops/chatcops#542 · 3 条评论 ·
维护者通常 1 天内回复
-
Server: validate `rateLimit.windowMs` before creating the limiter可能已有人在做 @ashutoshpalhare 于 3 天前认领。 未关闭
codercops/chatcops#452 · 1 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
-
Widget: a "New reply" button when the visitor has scrolled up可能已有人在做 @srujankaleru2007 于 4 天前认领。 未关闭enhancement widget
codercops/chatcops#420 · 3 条评论 · 已指派 1 人 ·
维护者通常 1 天内回复
查看 codercops/chatcops 的全部 Issue
相似的 Issue
-
docker infra P1 security size:S
难度 2/5 1-3 小时 新手友好度 68/100
josephfung/curia#2408 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 62/100
-
难度 2/5 1-3 小时 新手友好度 65/100
ehmpathy/rhachet-roles-ehmpathy#1231 ·
维护者通常 1 天内回复
-
enhancement good first issue help wanted
难度 2/5 半天 新手友好度 70/100
danielw-sudo/agentuto#32 ·
维护者通常 1 天内回复
-
type:docs
难度 2/5 1-3 小时 新手友好度 65/100
nightgauge/nightgauge#2836 ·
维护者通常 1 天内回复