docs: fix Offline Channel setup example - #2767
Merged
Hector Hernandez (hectorhdzg) merged 1 commit intoSep 8, 2026
Merged
Conversation
Register the channel during SDK initialization, wait for its deferred configuration, and use trackEvent with a compatible persistence level. Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com>
Hector Hernandez (hectorhdzg)
requested a review
from a team
as a code owner
September 8, 2026 20:43
Copilot started reviewing on behalf of
Hector Hernandez (hectorhdzg)
September 8, 2026 20:44
View session
Contributor
There was a problem hiding this comment.
🟢 Approval recommended
The change is isolated to documentation and the updated example aligns with the OfflineChannel’s deferred initialization and current SDK APIs.
Pull request overview
Updates the Offline Channel NPM setup documentation so the example code matches the SDK APIs and the channel’s deferred initialization behavior, preventing the “first events are dropped” footgun described in issues #2672 and #2673.
Changes:
- Registers
OfflineChannelduring SDK initialization viaconfig.extensions(instead of adding it afterloadAppInsights()). - Delays event tracking by one macrotask (
setTimeout(..., 0)) to allow the channel’s deferred configuration to complete. - Fixes the example API usage and configuration by using
trackEvent()and settingminPersistenceLevelto1.
File summaries
| File | Description |
|---|---|
| channels/offline-channel-js/README.md | Fixes the NPM setup example to initialize the Offline Channel correctly and use compatible tracking/configuration. |
Review details
- Files reviewed: 1/1 changed files
- Comments generated: 0
- Review effort level: Lite
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
Jackson Weber (JacksonWeber)
approved these changes
Sep 8, 2026
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.
Register the channel during SDK initialization, wait for its deferred configuration, and use trackEvent with a compatible persistence level.
Updates the Offline Channel NPM setup example so it works as documented:
Registers
OfflineChannelthroughconfig.extensionsbeforeloadAppInsights().Waits until the next event-loop turn before tracking events, allowing the channel’s deferred configuration to complete.
Changes
minPersistenceLevelto1, matching the default Normal persistence level used by the example events.Replaces the nonexistent
track()calls withtrackEvent().Adds the missing
ApplicationInsightsimport.Fixes #2672
Fixes #2673