Skip to content
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

fix: manage capture pageview hook lifecycle #1408

Merged
merged 4 commits into from
Sep 10, 2024

Conversation

pauldambra
Copy link
Member

Taking small steps to reorganise this.

First step is to increase the safety of calling start and stop multiple times

I have seen recordings with a surprising number of apparently duplicate custom pageview events

We always register a pageview callback when starting, instead of registering one when we don't have one

So, this:

  • changes _addCaptureHook to return the unsubscribe function
  • calls the unsubscribe when stopping
  • and only adds a listener if we don't already have one

Copy link

vercel bot commented Sep 10, 2024

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
posthog-js ✅ Ready (Inspect) Visit Preview Sep 10, 2024 2:03pm

@pauldambra pauldambra requested a review from a team September 10, 2024 09:22
Copy link

github-actions bot commented Sep 10, 2024

Size Change: +977 B (+0.08%)

Total Size: 1.19 MB

Filename Size Change
dist/array.full.js 341 kB +245 B (+0.07%)
dist/array.js 157 kB +244 B (+0.16%)
dist/main.js 158 kB +244 B (+0.15%)
dist/module.js 157 kB +244 B (+0.16%)
ℹ️ View Unchanged
Filename Size
dist/exception-autocapture.js 10.4 kB
dist/recorder-v2.js 110 kB
dist/recorder.js 111 kB
dist/surveys-preview.js 59.8 kB
dist/surveys.js 66 kB
dist/tracing-headers.js 8.26 kB
dist/web-vitals.js 10.3 kB

compressed-size-action

@pauldambra pauldambra added the bump patch Bump patch version when this PR gets merged label Sep 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bump patch Bump patch version when this PR gets merged
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants