Flagsmith / Flagsmith/flagsmith

Docs and dashboard code examples don't cover setContext or transient traits

Open
#8,076 0 comments 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
6.6k
Forks
567
Avg merge
1d 14h
Merged PRs (30d)
124

Description

### What's missing
The JavaScript client side SDK docs and the "Creating identities and getting their feature settings" example in the dashboard only show identity and traits being set through init options and identify. Neither mentions setContext or updateContext, and neither mentions transient traits at all.

This covers three docs pages (the JavaScript, React and Next.js client side SDK pages under docs.flagsmith.com/integrating-with-flagsmith/sdks/client-side-sdks) and the code example in the dashboard, which renders the same snippet on its JS, React and Next tabs.

### Why it matters
Transient traits only work through the context API. With nothing in the docs pointing at setContext, someone who needs a transient trait tries to pass `{ value, transient: true }` through the old traits option or identify. That path sends the object as the raw trait value, so the trait comes through as `trait_value "{'value': 'jooish', 'transient': True}"` with `transient false` and the flag gated on it evaluates wrong. setContext sends it correctly. Seen on v12.0.1 and current v12.x.

### What to add
Document setContext, updateContext, getContext and the evaluationContext init option as the current way to set identity and traits. Add a transient traits section using the `{ value, transient: true }` shape and the identity level transient flag, both through the context API. Update the JS, React and Next examples in the dashboard to match. Keep the identify and setTraits examples since they still work for plain traits, but note that transient traits need the context API.

Contributor guide

Open the contributing guide

Research direction

Start with the JavaScript, React and Next.js client-side SDK pages under docs.flagsmith.com/integrating-with-flagsmith/sdks/client-side-sdks, then find the dashboard example for “Creating identities and getting their feature settings.” Document the context APIs, evaluationContext, and transient traits, and update the shared JS, React and Next examples while retaining the plain-trait examples.

Written by the indexing model from the issue text.

Assessment

Tech stack
javascript, next.js, react
Domain
documentation, frontend
Issue type
Documentation
Difficulty
3/5
Estimated time
1-2 days
Activity status
Quiet
Clarity
Clearly specified
Newbie friendliness
68/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.