Move module-scope Emitter in react.tsx into the Provider

Open
#391 1 comment 0 reactions 0 assignees View on GitHub

@EngineerOnTravel is already working on this.

Since Aug 18, 2026.

  • #413 by @EngineerOnTravel — open

Assessment

Difficulty
3/5
Estimated time
1-2 days
Newbie friendliness
58/100
Issue type
Refactor
Clarity
Clearly specified
Activity status
Quiet
Tech stack
react, typescript
Domain
frontend

Research direction

Start in react.tsx, locating the module-scope Emitter, FlagsmithProvider, its context, and the hooks that consume the event bus. Move emitter ownership into each provider and expose it through context alongside flagsmith. Done means separate provider trees no longer share notifications, including on long-lived Node or SSR hosts.

Written by the indexing model from the issue text.

Description

bug good first issue

react.tsx instantiates a single Emitter at module scope, which means all <FlagsmithProvider> trees in a process share the same event bus.

On long-lived Node hosts (Fluid Compute, serverful SSR) this is a cross-request coupling hazard setups it causes unrelated providers to notify each other's hooks (safe today thanks to value comparisons).

Objective
Move the emitter to a useRef in FlagsmithProvider and pass it via context alongside flagsmith; hooks read it from context.

Surfaced by #390

Dominant language
TypeScript
Stars
67
Forks
47
Avg merge
1d 5h
Merged PRs (30d)
4

Getting set up

  • No Dockerfile or Docker Compose file
  • Has a pull request template
  • No contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

More from Flagsmith/flagsmith-js-client

All issues in Flagsmith/flagsmith-js-client

Similar issues

More TypeScript issues

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.