You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Add new 'on_navigation' option for capture_pageleave config that captures
pageleave events on every SPA navigation (pushState, replaceState, popstate)
in addition to window unload.
This enables the expected behavior pattern:
- pageView A → (navigate) → pageLeave A + pageView B → (navigate) → pageLeave B + pageView C
The implementation leverages PageViewManager.doPageLeave() to include all
scroll properties and previous pageview metadata in the pageleave event.
Changes:
- Add 'on_navigation' as new capture_pageleave option type
- Add _shouldCapturePageleaveOnNavigation() method to check if feature is enabled
- Modify HistoryAutocapture to call PageViewManager.doPageLeave() before capturing pageview during navigation
- Add _hasNavigated flag to prevent pageleave on first navigation
- Add comprehensive test coverage for all navigation types
fix: add missing _shouldCapturePageleaveOnNavigation mock to test setup
The main beforeEach was missing the mock for _shouldCapturePageleaveOnNavigation,
which caused the 'should track history through multiple pageviews' test to fail.
This method is called during navigation to check if pageleave should be captured,
so it needs to be mocked (returning false) for tests that aren't testing pageleave.
refactor: remove redundant _hasNavigated flag, rely on PageViewManager state
Check $prev_pageview_id from doPageLeave() to determine if there's a previous page to capture pageleave for.
refactor: remove redundant _hasNavigated flag, rely on PageViewManager state
Check from doPageLeave() to determine if there's a previous page to capture pageleave for.
Discard changes to .vscode/settings.json
Discard changes to packages/browser/src/session-props.ts
wip
0 commit comments