-
Notifications
You must be signed in to change notification settings - Fork 138
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 sessionRecording bug #234
Conversation
for (let url in requests) { | ||
const { data, options } = requests[url] | ||
for (let key in requests) { | ||
const { url, data, options } = requests[key] |
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.
Interesting. There are tests under src/tests/request-queue.js - mind adding one or editing existing ones in a way which demonstrates the problem? E.g. how was enqueue called in this case?
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.
Sure thing, that was the first item for today!
It's kinda unfortunate: we had a similar test for poll that works, but didn't have one for unload.
[{ event: '$identify', timestamp: 1_620_000_000 }], | ||
{ transport: 'sendbeacon' } | ||
) | ||
expect(given.handlePollRequest).toHaveBeenCalledWith('/e', [{ event: 'zeta', timestamp: 1_640_000_000 }], { |
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.
with the old code, this would be called with ('sessionRecording', data, options)
Great detective work! Reminder: don't forget to set |
Changes
Fixes #183
What a rollercoaster! The
url
is just one of many possible values for the key in the request object, the other possible options being:batchKey
, which, ofcourse, we set tosessionRecording
for session recording! ( https://github.com/PostHog/posthog-js/blob/master/src/extensions/sessionrecording.js#L122 )The annoying bit was figuring out that it was this specific part of the request queue that was mangling things up.
...
Checklist