-
Notifications
You must be signed in to change notification settings - Fork 58
refactor(analytics-browser): initialize diagnostics before useBrowserConfig #1479
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
refactor(analytics-browser): initialize diagnostics before useBrowserConfig #1479
Conversation
Initialize diagnostics early in
|
|
bugbot run |
|
bugbot run |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
✅ Bugbot reviewed your changes and found no bugs!
…Config refactor(analytics-browser): initialize diagnostics before useBrowserConfig test: test fix: comment
… into AMP-146280/diagnostics-cookie-storage-de-duplication
|
Probably NX cache causes CI failed I ran So close this PR and use the #1480 instead |

Summary
This PR restructures the initialization flow in
browser-client.tsto create theDiagnosticsClientas early as possible, allowing it to track more data during the SDK initialization process.Original Initialization Order
Step 2:
New Initialization Order
Step 2:
Checklist
Note
Moves diagnostics initialization ahead of browser config creation to capture more init telemetry and ensure consistent settings.
browser-client.ts, determinefetchRemoteConfigvia newshouldFetchRemoteConfig, fetchconfigs.diagnostics.browserSDKfirst, then instantiateDiagnosticsClientearly withLoggerandserverZone(defaulting toDEFAULT_SERVER_ZONE), and pass it plus early settings intouseBrowserConfig; fetchconfigs.analyticsSDK.browserSDKafterward and apply viaupdateBrowserConfigWithRemoteConfig.EarlyConfigand extenduseBrowserConfigto accept adiagnosticsClientand early logger/serverZone/diagnostics values; simplifyBrowserConfigconstructor fetch-remote-config logic toremoteConfig?.fetchRemoteConfig ?? fetchRemoteConfig.shouldFetchRemoteConfig(options)helper and corresponding unit tests; update tests to validate early diagnostics behavior, serverZone/enableDiagnostics overrides, and defaultfetchRemoteConfigbehavior.Written by Cursor Bugbot for commit 99751a8. Configure here.