Experiment events are lost when a visitor leaves within flushInterval (no flush on pagehide)
まだ誰も着手していません。
評価
- 難易度
- 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時間
- マージ済み PR(30日)
- 4
環境構築
- Dockerfile・Docker Compose ファイルなし
- プルリクエストのテンプレートあり
- コントリビューションガイドなし
はじめの一歩
- issue を最後まで読み、次にプロジェクトのコントリビューションガイドを読みます。
- 着手することを issue にコメントします — 二人が同じ作業をするのを防げます。
- リポジトリをフォークし、ブランチを切って変更します。
- 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 ·
-
Dependency Dashboardオープン
難易度 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 日以内に返信