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

🐛 ignore layout shifts that happen before view start #3058

Merged
merged 1 commit into from
Oct 9, 2024

Conversation

BenoitZugmeyer
Copy link
Member

@BenoitZugmeyer BenoitZugmeyer commented Oct 8, 2024

Motivation

On "route change" views, the CLS computation took any buffered layout shift entry into account, so in some cases it reflected the CLS of an anterior view.

Changes

This commit fixes the issue by ignoring layout shifts that happened before the view start.

We still use the buffered entries so we can use layout shift entries that happens before the SDK is initialized.

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

On "route change" views, the CLS computation took any buffered layout
shift entry into account, so in some cases it reflected the CLS of an
anterior view. This commit fixes the issue by ignoring layout shifts
that happened before the view start.

We still use the buffered entries so we can use layout shift entries
that happens before the SDK is initialized.
@BenoitZugmeyer BenoitZugmeyer requested a review from a team as a code owner October 8, 2024 11:26
@codecov-commenter
Copy link

codecov-commenter commented Oct 8, 2024

Codecov Report

Attention: Patch coverage is 91.66667% with 1 line in your changes missing coverage. Please review.

Project coverage is 93.53%. Comparing base (d2c974e) to head (178e876).
Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
...ain/view/viewMetrics/trackCumulativeLayoutShift.ts 91.66% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3058      +/-   ##
==========================================
- Coverage   93.67%   93.53%   -0.15%     
==========================================
  Files         275      275              
  Lines        7610     7611       +1     
  Branches     1707     1707              
==========================================
- Hits         7129     7119      -10     
- Misses        481      492      +11     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

Copy link

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 160.95 KiB 160.97 KiB 17 B +0.01%
Logs 56.00 KiB 56.00 KiB 0 B 0.00%
Rum Slim 109.53 KiB 109.54 KiB 17 B +0.02%
Worker 25.21 KiB 25.21 KiB 0 B 0.00%
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.001 0.001 0.000
addaction 0.030 0.030 0.001
addtiming 0.001 0.001 0.000
adderror 0.032 0.030 -0.002
startstopsessionreplayrecording 0.888 0.769 -0.119
startview 0.970 0.945 -0.025
logmessage 0.020 0.018 -0.002
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 7.29 KiB 8.22 KiB 952 B
addaction 39.11 KiB 40.99 KiB 1.88 KiB
addtiming 5.96 KiB 7.37 KiB 1.41 KiB
adderror 43.72 KiB 44.21 KiB 505 B
startstopsessionreplayrecording 4.29 KiB 5.09 KiB 824 B
startview 460.56 KiB 466.83 KiB 6.27 KiB
logmessage 39.25 KiB 42.59 KiB 3.33 KiB

🔗 RealWorld

@BenoitZugmeyer
Copy link
Member Author

/to-staging

@dd-devflow
Copy link
Contributor

dd-devflow bot commented Oct 8, 2024

🚂 Branch Integration: starting soon, median merge time is 0s

Commit 178e8767b0 will soon be integrated into staging-41.

Use /to-staging -c to cancel this operation!

dd-mergequeue bot added a commit that referenced this pull request Oct 8, 2024
@dd-devflow
Copy link
Contributor

dd-devflow bot commented Oct 8, 2024

🚂 Branch Integration: This commit was successfully integrated

Commit 178e8767b0 has been merged into staging-41 in merge commit 4364884347.

Check out the triggered pipeline on Gitlab 🦊

@dd-devflow dd-devflow bot added the staging-41 label Oct 8, 2024
@BenoitZugmeyer BenoitZugmeyer merged commit c8ee023 into main Oct 9, 2024
20 checks passed
@BenoitZugmeyer BenoitZugmeyer deleted the benoit/ignore-early-layout-shift branch October 9, 2024 09:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants