Experiment events are lost when a visitor leaves within flushInterval (no flush on pagehide)
Nadie ha tomado este issue todavía.
Evaluación
- Dificultad
- 4/5
- Tiempo estimado
- 3-5 días
- Aptitud para principiantes
- 48/100
- Tipo de issue
- Error
- Claridad
- Bastante claro
- Estado de actividad
- Activo
- Stack tecnológico
- javascript, playwright, react, typescript, vite
- Área
- analytics, backend-api-design
Línea de trabajo
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.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
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.
- Lenguaje dominante
- TypeScript
- Estrellas
- 67
- Forks
- 47
- Merge medio
- 1 d 5 h
- PR fusionados (30 d)
- 4
Preparar el entorno
- Sin Dockerfile ni archivo de Docker Compose
- Tiene una plantilla de pull request
- Sin guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de Flagsmith/flagsmith-js-client
-
`init({ traits })` double-wraps `{ value, transient }` trait objects, sending a nested `trait_value`Abierto
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
Flagsmith/flagsmith-js-client#444 ·
-
Dependency DashboardAbierto
Dificultad 1/5 Menos de una hora Aptitud para principiantes 20/100
Flagsmith/flagsmith-js-client#435 ·
-
Move module-scope Emitter in react.tsx into the ProviderPosiblemente ocupada @EngineerOnTravel la tomó hace 101 días. Abiertobug good first issue
Dificultad 3/5 1-2 días Aptitud para principiantes 58/100
Flagsmith/flagsmith-js-client#391 · 1 comentario ·
-
enhancement good first issue
Dificultad 2/5 1-3 horas Aptitud para principiantes 55/100
Flagsmith/flagsmith-js-client#371 ·
-
Dificultad 4/5 3-5 días Aptitud para principiantes 35/100
Flagsmith/flagsmith-js-client#330 ·
Todos los issues de Flagsmith/flagsmith-js-client
Issues similares
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 67/100
knaw-huc/textannoviz#742 ·
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 88/100
cloudflare/realtimekit-ui#219 ·
Los mantenedores suelen responder en 1 día
-
ui
Dificultad 2/5 1-3 horas Aptitud para principiantes 78/100
Los mantenedores suelen responder en 1 día
-
tui: Mermaid renderer displays <b>/<strong> tags literally and ignores \n line breaksPosiblemente ocupada @argszero la tomó hoy. Abiertoarea/tui platform/wsl status/repro-simulated type/bug version/v2
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
anomalyco/opencode#66773 · 2 comentarios ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
mermaid-js/mermaid-v13#1370 ·
Los mantenedores suelen responder en 1 día