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

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

Open
wants to merge 9 commits into
base: main
Choose a base branch
from

Conversation

RomanGaignault
Copy link
Contributor

@RomanGaignault RomanGaignault commented Jan 24, 2025

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.

@RomanGaignault RomanGaignault requested a review from a team as a code owner January 24, 2025 10:04
Copy link

cit-pr-commenter bot commented Jan 24, 2025

Bundles Sizes Evolution

📦 Bundle Name Base Size Local Size 𝚫 𝚫% Status
Rum 145.98 KiB 145.98 KiB 0 B 0.00%
Logs 51.06 KiB 51.06 KiB 0 B 0.00%
Rum Slim 104.77 KiB 104.77 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.001
addaction 0.039 0.034 -0.005
addtiming 0.001 0.001 -0.000
adderror 0.046 0.046 -0.001
startstopsessionreplayrecording 0.008 0.010 0.003
startview 0.414 0.349 -0.066
logmessage 0.022 0.022 -0.000
🧠 Memory Performance
Action Name Base Consumption Memory (bytes) Local Consumption Memory (bytes) 𝚫 (bytes)
addglobalcontext 27.33 KiB 29.36 KiB 2.03 KiB
addaction 54.12 KiB 60.33 KiB 6.21 KiB
addtiming 26.15 KiB 27.18 KiB 1.03 KiB
adderror 59.09 KiB 61.54 KiB 2.45 KiB
startstopsessionreplayrecording 24.90 KiB 25.13 KiB 239 B
startview 413.20 KiB 421.60 KiB 8.40 KiB
logmessage 60.18 KiB 63.42 KiB 3.24 KiB

🔗 RealWorld

@codecov-commenter
Copy link

codecov-commenter commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 93.73%. Comparing base (bfffdaf) to head (f4e3802).
Report is 4 commits behind head on main.

Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3299      +/-   ##
==========================================
+ Coverage   93.70%   93.73%   +0.03%     
==========================================
  Files         290      292       +2     
  Lines        7652     7658       +6     
  Branches     1745     1743       -2     
==========================================
+ Hits         7170     7178       +8     
+ Misses        482      480       -2     

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

Comment on lines +68 to +69
dev,react-router-dom-6,MIT,Copyright (c) React Training LLC 2015-2019 Copyright (c) Remix Software Inc. 2020-2021 Copyright (c) Shopify Inc. 2022-2023
dev,react-router-dom-7,MIT,Copyright (c) React Training LLC 2015-2019 Copyright (c) Remix Software Inc. 2020-2021 Copyright (c) Shopify Inc. 2022-2023
Copy link
Member

Choose a reason for hiding this comment

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

💬 suggestion: ‏We should tweak check-license.js to take the real package name into account instead of its alias (react-router-dom-6 is not an actual package).

eslint-local-rules/disallowSideEffects.js Show resolved Hide resolved

export const Routes = createRoutesComponent(useRoutes, createRoutesFromChildren)

export * from '../domain/reactRouter'
Copy link
Member

Choose a reason for hiding this comment

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

❓ question: ‏Is this needed?


export const Routes = createRoutesComponent(useRoutes, createRoutesFromChildren)

export * from '../domain/reactRouter'
Copy link
Member

Choose a reason for hiding this comment

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

❓ question: ‏Is this needed?

@@ -0,0 +1,14 @@
export type AnyRouteObject = { path?: string | undefined }
Copy link
Member

Choose a reason for hiding this comment

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

💬 suggestion: ‏Add a comment at the top of the file to explain those types, like:

// Those types are used by our instrumentation functions to make them work with any react-router
// version we support. We should not import react-router types as we don't know which version
// will be used by the customer.
//
// Those types should be:
// * compatible with all react-router-dom versions we support
// * include the minimal set of attributes used by our instrumentation functions.

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.

3 participants