-
Notifications
You must be signed in to change notification settings - Fork 261
Restart clarity when page is loaded from bfcache #1006
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
base: master
Are you sure you want to change the base?
Conversation
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.
Pull request overview
This PR adds support for automatically restarting Clarity when a page is restored from the browser's back-forward cache (bfcache). The version has been bumped to 0.8.47-beta across all packages in preparation for this feature release.
Key changes:
- Adds a new pageshow event handler to detect bfcache restoration and restart Clarity
- Introduces a BFCache diagnostic code for logging these events
- Updates all package versions to 0.8.47-beta with consistent dependency references
Reviewed changes
Copilot reviewed 10 out of 11 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| packages/clarity-js/src/interaction/pageshow.ts | New module that binds to the pageshow event and restarts Clarity when page is restored from bfcache (evt.persisted === true) |
| packages/clarity-js/src/interaction/index.ts | Integrates the new pageshow module into the interaction lifecycle by calling pageshow.start() and pageshow.stop() |
| packages/clarity-js/types/data.d.ts | Adds BFCache = 11 to the Code enum for diagnostic logging |
| packages/clarity-js/src/core/version.ts | Updates version to 0.8.47-beta |
| packages/clarity-js/package.json | Updates version to 0.8.47-beta |
| packages/clarity-decode/package.json | Updates version and clarity-js dependency to 0.8.47-beta |
| packages/clarity-visualize/package.json | Updates version and clarity-decode dependency to 0.8.47-beta |
| packages/clarity-devtools/package.json | Updates version and all clarity package dependencies to 0.8.47-beta |
| packages/clarity-devtools/static/manifest.json | Updates Chrome extension version to 0.8.47-beta |
| package.json | Updates root package version to 0.8.47-beta |
| lerna.json | Updates Lerna version to 0.8.47-beta |
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.
Pull request overview
Copilot reviewed 11 out of 12 changed files in this pull request and generated 4 comments.
This pull request introduces support for detecting and handling browser back-forward cache (bfcache) restoration events. The bfcache support ensures Clarity restarts and logs a diagnostic event when a page is restored from bfcache, improving reliability in session tracking. Comprehensive tests are also added to verify this new behavior.