fix: wait for initial remote config before autocapture - #4805
Open
marandaneto wants to merge 1 commit into
Open
Conversation
Contributor
|
Reviews (1): Last reviewed commit: "fix: wait for initial remote config befo..." | Re-trigger Greptile |
Contributor
Contributor
|
Size Change: +796 B (0%) Total Size: 20.4 MB 📦 View Changed
ℹ️ View Unchanged
|
Contributor
posthog-js Compliance ReportDate: 2026-09-05 17:33:12 UTC ✅ All Tests Passed!26/26 tests passed Capture Tests✅ 26/26 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.
Problem
Returning visitors can send autocapture events using cached enablement while the SDK loads fresh settings, even after a project remotely disables autocapture.
Addresses #2097. The broader Next.js SSR integration request is outside this fix.
Changes
Wait for the initial remote-config outcome before using cached autocapture enablement. Clicks during that wait are dropped, not buffered. Keep explicit local opt-out, synchronous preloaded config, and startup with remote requests disabled unchanged. Failed or incomplete responses still use the cached fallback, so this does not guarantee fresh settings without connectivity.
Add 14 regression cases covering these paths and later remote disable/re-enable. Include the existing posthog-js patch changeset.
Validation
3d1d6e1f10733e3bf06f9802a61dc1eba79dcdf0againstorigin/main, with no actionable findings.Release info Sub-libraries affected
Libraries affected
Checklist
If releasing new changes
🤖 Agent context
Autonomy: Human-driven (agent-assisted)
Pi implemented and reviewed the user-directed fix. Tools included Git, pnpm/Vitest, TypeScript, Oxlint/Oxfmt, GitHub CLI, and isolated Pi autoreview. The existing config lifecycle was reused instead of adding buffering, timers, or an SSR API. Human review is required. No shareable session URL is available.