Skip to content

✨ [RUM-5500] React-router v7 support - #3299

Merged
rgaignault merged 20 commits into
mainfrom
romanG/add-support-for-react-router-v7
Feb 24, 2025
Merged

rgaignault merged 20 commits into
mainfrom
romanG/add-support-for-react-router-v7

Conversation

@rgaignault

@rgaignault rgaignault commented Jan 24, 2025 •

Copy link
Copy Markdown
Contributor

Motivation

Add support for react-router v7 for the rum-react plugin.

Changes

Reuse as much as possible the code from react-router-6, adapt unit test instead of cloning them

Testing

  • Local
  • Staging
  • Unit
  • End to end

I have gone over the contributing documentation.

@rgaignault
rgaignault requested a review from a team as a code owner January 24, 2025 10:04
@cit-pr-commenter

cit-pr-commenter Bot commented Jan 24, 2025 •

Copy link
Copy Markdown

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 148.16 KiB 148.16 KiB 0 B 0.00% ✅
Logs 52.19 KiB 52.19 KiB 0 B 0.00% ✅
Rum Slim 106.82 KiB 106.82 KiB 0 B 0.00% ✅
Worker 24.50 KiB 24.50 KiB 0 B 0.00% ✅
🚀 CPU Performance
Action Name Base Average Cpu Time (ms) Local Average Cpu Time (ms) 𝚫
addglobalcontext 0.003 0.002 -0.002
addaction 0.271 0.037 -0.234
addtiming 0.003 0.001 -0.002
adderror 0.224 0.058 -0.166
startstopsessionreplayrecording 0.014 0.010 -0.004
startview 0.853 0.381 -0.472
logmessage 0.078 0.020 -0.058
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 29.91 KiB 29.99 KiB 85 B
addaction 60.93 KiB 56.79 KiB -4238 B
addtiming 28.16 KiB 28.47 KiB 323 B
adderror 61.54 KiB 61.27 KiB -276 B
startstopsessionreplayrecording 27.64 KiB 25.60 KiB -2087 B
startview 425.88 KiB 425.47 KiB -416 B
logmessage 64.26 KiB 56.77 KiB -7663 B

🔗 RealWorld

@codecov-commenter

codecov-commenter commented Jan 24, 2025 •

Copy link
Copy Markdown

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 92.78%. Comparing base (5909405) to head (134f41a).

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3299      +/-   ##
==========================================
+ Coverage   92.76%   92.78%   +0.02%     
==========================================
  Files         297      299       +2     
  Lines        7852     7860       +8     
  Branches     1790     1790              
==========================================
+ Hits         7284     7293       +9     
+ Misses        568      567       -1     

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

Comment thread packages/rum-react/package.json Resolved
Comment thread LICENSE-3rdparty.csv Resolved

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Open question: is there a way in the browser-sdk to mark a file as existing only for tests?
When looking at this file without too much context, it can be hard to understand that this should only be used by spec files / the sandbox react app, and not by code exposed to npm

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  • Code that is intended for the user is within packages/*/src except *.spec.* files.
  • Code for tests are *.spec.* files and files within test/ folders
  • Sandbox is not user facing

Does it answer your question?

@Miz85 Miz85 left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

With v7 it looks like you can use react router as a routing library or as a framework. I think this PR covers everything from the library but in the framework part, they introduced a route modules and a route wrapper function. Maybe we could try to see if we can also instrument that? It def. can come in another PR though.

@Miz85

Miz85 commented Feb 14, 2025

Copy link
Copy Markdown
Contributor

Just tested on a new app using React Router v7 and it seems to work fine! I do have a weird type error though:
image

I built and linked @datadog/browser-rum-react from this branch and I installed @datadog/browser-rum-react from npm (^6.3.0).

I don't seem to have it when I also link @datadog/browser-rum built on this branch so it might be just a version discrepency but thought I'd mention it!

Comment thread scripts/check-licenses.js Resolved
@rgaignault
rgaignault force-pushed the romanG/add-support-for-react-router-v7 branch from 564425a to 0c7bb7d Compare February 18, 2025 00:51
@rgaignault
rgaignault force-pushed the romanG/add-support-for-react-router-v7 branch from b49df4d to 274b11e Compare February 21, 2025 15:42
@rgaignault
rgaignault merged commit 191cc43 into main Feb 24, 2025
@rgaignault
rgaignault deleted the romanG/add-support-for-react-router-v7 branch February 24, 2025 10:30
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants