Repository navigation
feat: [SDK-5381] enqueue a session create when a new session starts - #1580
Open
fadi-george wants to merge 1 commit into
Open
fadi-george wants to merge 1 commit into
fadi-george wants to merge 1 commit into
Conversation
Co-Authored-By: Claude Opus 5.5 <[email protected]>
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.
Description
1 Line Summary
When the sessions API flag is on, the service worker enqueues a session create when a new session starts.
Details
Part of the Web SDK Sessions stack (SDK-5381), on top of the SDK-5377 queue (#1571 to #1574). Android counterpart: OneSignal/OneSignal-Android-SDK#2797. iOS: OneSignal/OneSignal-iOS-SDK#1779.
upsertSessionenqueues one create on the new-session path (no stored session, or the previous one is past the threshold) when the session's capturedusesSessionsApiis true. It carries the local session ID, pinned OneSignal and subscription IDs, the subscription type, andstart_time. The worker then sends the legacyon_sessionand drains the queue in parallel.navigator.locksexists, since the queue serializes IndexedDB work with Web Locks. This drops Chrome 61 to 68, Firefox 57 to 95, and legacy Safari push before 15.4.direct_attribution_id(SDK-5399), session end (SDK-5392).Systems Affected
Validation
Tests
Info
Added
ServiceWorkertests: create fields and drain with the flag on, one create across repeated upserts, no create on resume within the threshold, a new create after the threshold, no create with the flag off, and no create with a local ID. Added a shim loader test for a browser without Web Locks.vp run lint,vp test run, andvp run build:prodpass locally. Not tested in a browser yet.Checklist
Programming Checklist
Interfaces:
Functions:
Typescript:
Other:
elem of arraysyntax. PreferforEachor usemapcontextif possible. Instead, we can pass it to function/constructor so that we don't callOneSignal.contextScreenshots
Info
Not needed; no UI changes.
Checklist
Related Tickets
SDK-5381
🤖 Generated with Claude Code