-
-
Notifications
You must be signed in to change notification settings - Fork 1.7k
fix(browser): Improve handling of 0
and undefined
resource timing values
#17751
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(browser): Improve handling of 0
and undefined
resource timing values
#17751
Conversation
size-limit report 📦
|
* In contrast to `dropUndefinedKeys` in core this funciton only works on first-level | ||
* key-value objects and does not recursively go into object properties or arrays. | ||
*/ | ||
function dropUndefinedKeysFromObject<T extends object>(attrs: T): T { |
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.
this is probably useful to be extracted into browser or core at some point. I know we had our reservations against dropUndefinedKeys
but IIRC this was mainly due to over-usage and it recursively going through the object. I think a light-weight implementation like this one should be fine but happy to hear other opinions.
Main motivation for using it in browser: it's more size-efficient than checking every value for definedness before adding the attribute.
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.
nice, this makes sense to me! We should make sure we handle this appropriately in product, as this could also be confusing to users why this would be 0/
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.
good change!
Co-authored-by: Abhijeet Prasad <aprasad@sentry.io>
Our previous resource timing implementation had two flaws:
undefined
resoure timing values to0
, leading to them being converted the absolutetimeOrigin
timestamp0
resource timing values to the absoluetimeOrigin
timestampTiming-Allow-Origin
header, since a lot of the detailed timing information is guarded by browsers.This PR
undefined
0
for any timing values that were originally0
(i.e. no longer converts them to thetimeOrigin
absolute timestamp)closes https://linear.app/getsentry/issue/JS-968/investigate-httprequestfetch-start-after-httprequestresponse-start