fix(flags): surface that preloadFeatureFlags is ignored on Flutter web - #509
Draft
posthog[bot] wants to merge 1 commit into
Draft
fix(flags): surface that preloadFeatureFlags is ignored on Flutter web#509posthog[bot] wants to merge 1 commit into
posthog[bot] wants to merge 1 commit into
Conversation
posthog-js is initialized by the host app on web, so PostHogConfig.preloadFeatureFlags never reaches it. Setting it to false was a silent no-op. - Warn in debug builds during web setup when preloadFeatureFlags is false (pointing at advanced_disable_feature_flags_on_first_load) or when bootstrap is set. - Document the web gap on preloadFeatureFlags, mirroring the note bootstrap already carries. - Document that identify() and group() reload feature flags regardless of preloadFeatureFlags. Generated-By: PostHog Code Task-Id: b8ef6da1-fe3d-47ac-9901-7406d300f36a
Contributor
posthog-flutter Compliance ReportDate: 2026-07-30 17:16:17 UTC ✅ All Tests Passed!45/45 tests passed Capture Tests✅ 29/29 tests passed View Details
Feature_Flags Tests✅ 16/16 tests passed View Details
|
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.
💡 Motivation and Context
Customers told to set
preloadFeatureFlags = falseto cut feature-flag request volume see no change on Flutter web. On web, posthog-js is initialized by the host app, so the option (likebootstrap) never reaches the JS SDK — it is a silent no-op.bootstrapat least documents this;preloadFeatureFlagssaid nothing, so the recommended workaround reads as "the flag didn't work" on the web half of a customer's traffic.This makes the gap visible rather than silent:
setup()now emits a debug-build warning whenpreloadFeatureFlagsisfalse(pointing atadvanced_disable_feature_flags_on_first_loadinposthog.init) or whenbootstrapis set.preloadFeatureFlagsdocs carry the same Flutter web: not applied notebootstrapalready has.identify()andgroup()docs now say they reload feature flags, so turning preloading off alone does not remove those requests.Scope note: this does not change request volume on iOS/Android. The bigger win the ticket describes — a cached-flags freshness window so a cold open serves persisted flags instead of refetching — lives in posthog-ios/posthog-android with a passthrough option here, and is not attempted in this PR.
💚 How did you test it?
Added
posthog_flutter/test/posthog_flutter_web_setup_test.dart(browser-only) covering: warning emitted whenpreloadFeatureFlagsisfalse, no warning on the default, and thebootstrapwarning.I was not able to run the test suite or the analyzer — no Flutter toolchain is available in the environment this was authored in, so the tests are unverified and CI is the first real run. Please treat the test as needing a green CI before merge. The rest of the change is doc comments plus two guarded
printIfDebugcalls.📝 Checklist
pnpm changesetequivalent (changeset file added by hand)🤖 Agent context
Autonomy: Fully autonomous
Authored by Claude (PostHog Code) from a Signals inbox report about feature-flag request volume. Checked for competing work first — the only open PRs are session replay and surveys work, and no open issue matched.
Decision made along the way: the report's headline fix (a cached-flags freshness window) cannot be implemented in this repo, so this PR deliberately covers only the Flutter-web silent no-op, and adds a runtime warning rather than docs alone so the misconfiguration is discoverable without reading dartdoc.
Created with PostHog Desktop from this inbox report.