Flagsmith / Flagsmith/flagsmith-js-client
Move module-scope Emitter in react.tsx into the Provider
- Dominant language
- TypeScript
- Stars
- 67
- Forks
- 45
- Avg merge
- 1d 8h
- Merged PRs (30d)
- 4
Description
`react.tsx` instantiates a single Emitter at module scope, which means all `` 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
Contributor guide
No contributing guide indexed for this repository
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.
Assessment
- Tech stack
- react, typescript
- Domain
- frontend
- Issue type
- Refactor
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Quiet
- Clarity
- Clearly specified
- Newbie friendliness
- 58/100