Repository navigation
Document get_all_variants and get_all_variants_sync on the JS flags page - #257
Merged
Merged
Conversation
Both methods ship in mixpanel-js v2.79.0 and are in the public typings, but were absent from the JavaScript feature flags page. Mirrors the structure of the Swift page's "Get All Flag Assignments" section, with behavior derived from src/flags/index.js rather than from the Swift docs. Covers the JS-specific details: - Neither method routes through trackFeatureCheck, so neither fires $experiment_started exposure tracking. - The return value is a Map, not a plain object, so Object.keys() yields an empty array. Examples use forEach and for...of. - Both take no arguments and have no fallback parameter. - Per-policy async resolution, and the fact that the async method awaits an in-flight fetch rather than starting one (unlike Swift). - Both hand back the SDK's internal Map by reference. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Contributor
|
Preview deployment for your docs. Learn more about Mintlify Previews.
|
Contributor
[Low impact] The PR appears safe to merge; no new actionable issue was found. Reviews (10) · Last reviewed commit: "Merge branch 'main' into docs/js-flags-g..." · Reviewed by Greptile |
efahk
approved these changes
Sep 28, 2026
Co-authored-by: efahk <37164746+efahk@users.noreply.github.com>
mbocianski
approved these changes
Sep 29, 2026
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
julianneb-mixpanel
approved these changes
Oct 23, 2026
myronkaifung
approved these changes
Oct 28, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Adds a Get All Flag Assignments section to the JavaScript (Web) feature flags page.
get_all_variants()andget_all_variants_sync()have shipped inmixpanel-jssince v2.79.0 and are in the public typings (FlagsManager), but appeared nowhere on the page.Docs-only. No SDK changes, and the Swift page is untouched.
Structure
Mirrors the Swift page's equivalent section — same H3 placement under Flag Evaluation, same Synchronous/Asynchronous split — but the documented behavior is derived from
src/flags/index.js, not from the Swift copy.The JS-specific details it covers
trackFeatureCheckhas exactly one call site in the SDK (getVariantSync,src/flags/index.js:580); neither all-variants method reaches it, so no$experiment_startedis sent. Pinned by a test attests/unit/flags.js:1495. This is the main reason people reach for these methods, so it leads the section.Map, not a plain object. Swift's dictionary idiom doesn't translate andObject.keys(variants)silently yields[]. Examples use.forEach((variant, key) => ...)andfor...of.get_variant— an unassigned flag is simply absent rather than falling back.networkOnly/networkFirst/persistenceUntilNetworkSuccess), drawn from the tests attests/unit/flags.js:1417,:1423, and:1436. The async method always resolves and never rejects.getAllVariantschecksthis.fetchPromiseand returns an emptyMapif nothing is in flight; it never callsloadFlags. Documented as the JS behavior.Mapby reference, not a copy (tests/unit/flags.js:1492asserts strict identity). Mutating the result corrupts SDK flag state, so that gets a<Warning>.Version claim
v2.79.0, established from the SDK repo rather than assumed. Both methods and their snake_case aliases landed together in c3a3e83 (mixpanel/mixpanel-js#433, "Implement flags variant persistence"); earliest tag containing it isv2.79.0; CHANGELOG 2.79.0 (14 May 2026) describes the persistence work; npm confirms 2.79.0 published 2026-05-14. Consistent with the version note already on the page's Flag Persistence section.Left out, on purpose
get_variant_sync,are_flags_ready,load_flags, andwhen_readyalso ship undocumented on this page. Kept out to keep this diff reviewable — happy to follow up in a separate PR.Reviewer note
The
## Flag Evaluationpreamble still says "This action triggers tracking an exposure event," which the new subsection contradicts locally. I left it alone because the Swift page has the same tension and resolves it in the subsection rather than the parent heading. Easy to soften if you'd rather.🤖 Generated with Claude Code