fix(browser): Improve handling of 0 and undefined resource timing values#17751
Merged
fix(browser): Improve handling of 0 and undefined resource timing values#17751
0 and undefined resource timing values#17751Conversation
Contributor
size-limit report 📦
|
Lms24
commented
Sep 24, 2025
| * 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 { |
Member
Author
There was a problem hiding this comment.
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.
mydea
reviewed
Sep 24, 2025
mydea
reviewed
Sep 24, 2025
mydea
approved these changes
Sep 24, 2025
Member
mydea
left a comment
There was a problem hiding this comment.
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/
Co-authored-by: Abhijeet Prasad <[email protected]>
AbhiPrasad
approved these changes
Sep 24, 2025
This was referenced Sep 29, 2025
This was referenced Oct 7, 2025
This was referenced Oct 15, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Our previous resource timing implementation had two flaws:
undefinedresoure timing values to0, leading to them being converted the absolutetimeOrigintimestamp0resource timing values to the absoluetimeOrigintimestampTiming-Allow-Originheader, since a lot of the detailed timing information is guarded by browsers.This PR
undefined0for any timing values that were originally0(i.e. no longer converts them to thetimeOriginabsolute timestamp)closes https://linear.app/getsentry/issue/JS-968/investigate-httprequestfetch-start-after-httprequestresponse-start