Experiment events are lost when a visitor leaves within flushInterval (no flush on pagehide)
还没有人认领这个 Issue。
评估
- 难度
- 4/5
- 预计耗时
- 3-5 天
- 新手友好度
- 48/100
- Issue 类型
- 缺陷
- 描述清晰度
- 基本清楚
- 活跃度
- 活跃
- 技术栈
- javascript, playwright, react, typescript, vite
调研方向
Start by locating the event processor and its flush interval behavior; the issue does not name source files or tests. Reproduce the reported short-visit case in the Playwright browser setup, then inspect how page lifecycle events and event delivery are handled. Done means exposures and conversions are delivered when a visitor leaves before the interval, with regression coverage for that case.
由索引模型根据 Issue 内容生成。
描述
Version: @flagsmith/flagsmith 12.6.0 (latest), browser, Experimentation with enableEvents: true.
What happens: the event processor buffers exposures and trackEvent calls and sends them every flushInterval (default 1e4, 10 seconds). Nothing flushes the buffer when the page is hidden or closed: there is no pagehide / visibilitychange handler, and the request doesn't use keepalive or navigator.sendBeacon. A visitor who leaves within 10 seconds never reaches the experiment, and neither does a conversion made just before leaving.
How we saw it: we ran 40 scripted browser visits (Playwright, real Chromium) through an experiment on a React + Vite app wired with FlagsmithProvider, getExperimentFlag and trackEvent. Each visit lasted 3–6 seconds.
| Visits | Exposures recorded |
|---|---|
3–6 s, default flushInterval |
0 of 40 |
11 s, default flushInterval |
40 of 40 |
3–6 s, eventProcessorConfig: { flushInterval: 1000 } |
40 of 40 |
Same app, same build, same Flagsmith instance; only the visit length or the interval changed. The app also called flagsmith.flushEvents() from a pagehide listener; with visits that end by closing the page, that didn't deliver the events either.
Why it matters for experiments: if one variant makes people leave sooner, that arm loses more exposures and conversions than the other, so the result is biased, and the sample ratio may still look fine.
Suggestion: flush on pagehide (and visibilitychange to hidden) with fetch(url, { keepalive: true, ... }) or navigator.sendBeacon, and consider a shorter default interval for experiment exposures. Until then, a line about flushInterval in the Experimentation docs and the coding-agent set-up prompt would save people from this.
- 主要语言
- TypeScript
- 星标
- 67
- 派生
- 47
- 平均合并
- 1 天 5 小时
- 30 天内合并 PR
- 4
环境准备
- 没有 Dockerfile 或 Docker Compose 文件
- 有 Pull Request 模板
- 没有贡献指南
从这里开始
- 先读完整个 Issue,再读项目的贡献指南。
- 在 Issue 下留言说明你要接手 —— 这能避免两个人做同样的事。
- Fork 仓库,在一个分支上完成修改。
- 提交 Pull Request,并在描述里引用这个 Issue 编号。
Flagsmith/flagsmith-js-client 的其他 Issue
-
`init({ traits })` double-wraps `{ value, transient }` trait objects, sending a nested `trait_value`未关闭
难度 2/5 1-3 小时 新手友好度 82/100
Flagsmith/flagsmith-js-client#444 ·
-
难度 1/5 1 小时以内 新手友好度 20/100
Flagsmith/flagsmith-js-client#435 ·
-
Move module-scope Emitter in react.tsx into the Provider可能已有人在做 @EngineerOnTravel 于 101 天前认领。 未关闭bug good first issue
难度 3/5 1-2 天 新手友好度 58/100
Flagsmith/flagsmith-js-client#391 · 1 条评论 ·
-
enhancement good first issue
难度 2/5 1-3 小时 新手友好度 55/100
Flagsmith/flagsmith-js-client#371 ·
-
难度 4/5 3-5 天 新手友好度 35/100
Flagsmith/flagsmith-js-client#330 ·
查看 Flagsmith/flagsmith-js-client 的全部 Issue
相似的 Issue
-
难度 2/5 1-3 小时 新手友好度 67/100
knaw-huc/textannoviz#742 ·
-
难度 2/5 1-3 小时 新手友好度 88/100
cloudflare/realtimekit-ui#219 ·
维护者通常 1 天内回复
-
ui
难度 2/5 1-3 小时 新手友好度 78/100
维护者通常 1 天内回复
-
tui: Mermaid renderer displays <b>/<strong> tags literally and ignores \n line breaks可能已有人在做 @argszero 今天认领。 未关闭area/tui platform/wsl status/repro-simulated type/bug version/v2
难度 2/5 1-3 小时 新手友好度 82/100
anomalyco/opencode#66773 · 2 条评论 ·
维护者通常 1 天内回复
-
难度 2/5 1-3 小时 新手友好度 82/100
mermaid-js/mermaid-v13#1370 ·
维护者通常 1 天内回复