newrelic / newrelic-browser-agent

New Relic Browser Agent
Apache License 2.0
77 stars 40 forks source link

fix: recordReplay will restart replays on same session page loads #1093

Closed cwli24 closed 3 months ago

cwli24 commented 3 months ago

Patch a case of recordReplay not restarting session replay. Customers can now programatically continue the session replay after a hard page navigation.

Overview

Change old smart-attempt logic to exclude SR agg from loading if existing session mode is off to always load as long as session entity itself was initialized and exists. This ensure the aggregate is around to listen for recordReplay calls which forces the start of replay regardless of existing session mode being off (as long as entitlements are valid).

Related Issue(s)

https://new-relic.atlassian.net/browse/NR-285311

Testing

Run new test file w/ old build; new test will fail with mode still being 0. Run it with PR build, new test passes with mode 1.

github-actions[bot] commented 3 months ago

Asset Size Report

Merging this pull request will result in the following asset size changes:

Agent Asset Previous Size New Size Diff
lite loader 34.73 kB / 12.13 kB (gzip) 34.71 kB / 12.1 kB (gzip) -0.07% / -0.26% (gzip)
lite async-chunk 50.09 kB / 16.18 kB (gzip) 50.09 kB / 16.18 kB (gzip) 0% / 0% (gzip)
pro loader 55.29 kB / 18.72 kB (gzip) 55.24 kB / 18.69 kB (gzip) -0.09% / -0.14% (gzip)
pro async-chunk 96.12 kB / 28.85 kB (gzip) 96.12 kB / 28.85 kB (gzip) 0% / 0% (gzip)
spa loader 63.23 kB / 21.14 kB (gzip) 63.18 kB / 21.12 kB (gzip) -0.08% / -0.13% (gzip)
spa async-chunk 111.23 kB / 33.23 kB (gzip) 111.23 kB / 33.23 kB (gzip) 0% / 0% (gzip)
lite-polyfills loader 128.42 kB / 41.46 kB (gzip) 128.38 kB / 41.43 kB (gzip) -0.03% / -0.07% (gzip)
lite-polyfills async-chunk 63.99 kB / 18.45 kB (gzip) 63.99 kB / 18.45 kB (gzip) 0% / 0% (gzip)
pro-polyfills loader 150.62 kB / 47.69 kB (gzip) 150.57 kB / 47.66 kB (gzip) -0.03% / -0.06% (gzip)
pro-polyfills async-chunk 116.19 kB / 31.08 kB (gzip) 116.19 kB / 31.08 kB (gzip) 0% / 0% (gzip)
spa-polyfills loader 158.81 kB / 49.85 kB (gzip) 158.77 kB / 49.82 kB (gzip) -0.03% / -0.06% (gzip)
spa-polyfills async-chunk 133.16 kB / 35.78 kB (gzip) 133.16 kB / 35.78 kB (gzip) 0% / 0% (gzip)
codecov[bot] commented 3 months ago

Codecov Report

All modified and coverable lines are covered by tests :white_check_mark:

Project coverage is 87.62%. Comparing base (c384834) to head (61cf00f).

:exclamation: Current head 61cf00f differs from pull request most recent head 8fbbeb5

Please upload reports for the commit 8fbbeb5 to get more accurate results.

Additional details and impacted files ```diff @@ Coverage Diff @@ ## main #1093 +/- ## ======================================= Coverage 87.62% 87.62% ======================================= Files 162 162 Lines 7249 7251 +2 Branches 1421 1422 +1 ======================================= + Hits 6352 6354 +2 Misses 781 781 Partials 116 116 ``` | [Flag](https://app.codecov.io/gh/newrelic/newrelic-browser-agent/pull/1093/flags?src=pr&el=flags&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | Coverage Δ | | |---|---|---| | [integration-tests](https://app.codecov.io/gh/newrelic/newrelic-browser-agent/pull/1093/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `91.49% <100.00%> (ø)` | | | [unit-tests](https://app.codecov.io/gh/newrelic/newrelic-browser-agent/pull/1093/flags?src=pr&el=flag&utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic) | `76.43% <100.00%> (+<0.01%)` | :arrow_up: | Flags with carried forward coverage won't be shown. [Click here](https://docs.codecov.io/docs/carryforward-flags?utm_medium=referral&utm_source=github&utm_content=comment&utm_campaign=pr+comments&utm_term=newrelic#carryforward-flags-in-the-pull-request-comment) to find out more.

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

github-actions[bot] commented 3 months ago

Static Badge

Last ran on June 28, 2024 10:11:26 CDT Checking merge of (61cf00fbdcca31901f2b4429b49eb8eaa8668dd8) into main (c38483465b3cad54b8beacaa8ebba62e166e686c)