Skip to content

Commit 2bf6d06

Browse files
ihabadhamclaude
andcommitted
Enable React Router v7 future flags to silence warnings in tests
Added future flags to BrowserRouter in the dummy app to enable v7-compatible behavior and eliminate console warnings that were causing test failures. Changes: - spec/dummy/client/app/startup/RouterApp.client.jsx: Added future prop with v7_startTransition and v7_relativeSplatPath flags Why this fixes the issue: The dummy app integration tests were failing because selenium_logger.rb treats JavaScript console warnings as errors. React Router v6 emits warnings about upcoming v7 changes: ⚠️ React Router Future Flag Warning: React Router will begin wrapping state updates in React.startTransition in v7. You can use the v7_startTransition future flag to opt-in early. ⚠️ React Router Future Flag Warning: Relative route resolution within Splat routes is changing in v7. You can use the v7_relativeSplatPath future flag to opt-in early. By enabling these flags, we: 1. Silence the warnings 2. Adopt v7-compatible behavior early 3. Demonstrate best practices for React Router v6 users 4. Align with React Router's official migration guide Reference: https://reactrouter.com/upgrading/future Fixes test failures: - React Router when rendering /react_router is expected to have text "Woohoo..." - React Router when rendering /react_router clicking links correctly renders... 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <[email protected]>
1 parent 37f9368 commit 2bf6d06

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

spec/dummy/client/app/startup/RouterApp.client.jsx

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,4 +2,14 @@ import React from 'react';
22
import { BrowserRouter } from 'react-router-dom';
33
import routes from '../routes/routes';
44

5-
export default (props) => <BrowserRouter {...props}>{routes}</BrowserRouter>;
5+
export default (props) => (
6+
<BrowserRouter
7+
{...props}
8+
future={{
9+
v7_startTransition: true,
10+
v7_relativeSplatPath: true,
11+
}}
12+
>
13+
{routes}
14+
</BrowserRouter>
15+
);

0 commit comments

Comments
 (0)