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

chore: Use Flow 24.7 snapshot and React Router v7 #2961

Merged
merged 9 commits into from
Dec 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
77 changes: 45 additions & 32 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ import org.junit.Before
abstract class AbstractGradleTest {

val hillaVersion = System.getenv("hilla.version").takeUnless { it.isNullOrEmpty() } ?: "24.7-SNAPSHOT"
val flowVersion = System.getenv("flow.version").takeUnless { it.isNullOrEmpty() } ?: "24.6-SNAPSHOT"
val flowVersion = System.getenv("flow.version").takeUnless { it.isNullOrEmpty() } ?: "24.7-SNAPSHOT"
/**
* The testing Gradle project. Automatically deleted after every test.
* Don't use TemporaryFolder JUnit `@Rule` since it will always delete the folder afterward,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import router from 'Frontend/routes.js';
import { RouterProvider } from 'react-router-dom';
import { RouterProvider } from 'react-router';

export default function App() {
return <RouterProvider router={router} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Scroller } from '@vaadin/react-components/Scroller.js';
import Placeholder from 'Frontend/components/placeholder/Placeholder.js';
import { MenuProps, routes, useViewMatches, ViewRouteObject } from 'Frontend/routes.js';
import { Suspense } from 'react';
import { NavLink, Outlet } from 'react-router-dom';
import { NavLink, Outlet } from 'react-router';
import css from './MainLayout.module.css';

type MenuRoute = ViewRouteObject &
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import HelloReactView from './_views/helloreact/HelloReactView.js';
import MainLayout from './_views/MainLayout.js';
import { lazy } from 'react';
import { createBrowserRouter, IndexRouteObject, NonIndexRouteObject, useMatches } from 'react-router-dom';
import { createBrowserRouter, IndexRouteObject, NonIndexRouteObject, useMatches } from 'react-router';

const AboutView = lazy(async () => import('./_views/about/AboutView.js'));
export type MenuProps = Readonly<{
Expand Down
2 changes: 1 addition & 1 deletion packages/java/tests/gradle/single-module/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
org.gradle.daemon=false
hillaVersion=24.7-SNAPSHOT
flowVersion=24.6-SNAPSHOT
flowVersion=24.7-SNAPSHOT
vaadinComponentsVersion=24.6-SNAPSHOT
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import router from './routes';
import { RouterProvider } from 'react-router-dom';
import { RouterProvider } from 'react-router';

export default function App() {
return <RouterProvider router={router} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { Scroller } from '@vaadin/react-components/Scroller.js';
import Placeholder from '../components/placeholder/Placeholder';
import { MenuProps, routes, useViewMatches, ViewRouteObject } from '../routes';
import { Suspense } from 'react';
import { NavLink, Outlet } from 'react-router-dom';
import { NavLink, Outlet } from 'react-router';
import css from './MainLayout.module.css';

type MenuRoute = ViewRouteObject &
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
import HelloReactView from './_views/helloreact/HelloReactView';
import MainLayout from './_views/MainLayout';
import { lazy } from 'react';
import { createBrowserRouter, IndexRouteObject, NonIndexRouteObject, useMatches } from 'react-router-dom';
import { createBrowserRouter, IndexRouteObject, NonIndexRouteObject, useMatches } from 'react-router';

const AboutView = lazy(async () => import('./_views/about/AboutView'));
export type MenuProps = Readonly<{
Expand Down
2 changes: 1 addition & 1 deletion packages/java/tests/spring/native/frontend/App.tsx
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import router from 'Frontend/routes.js';
import { AuthContext, useAuth } from 'Frontend/useAuth.js';
import { RouterProvider } from 'react-router-dom';
import { RouterProvider } from 'react-router';

export default function App() {
const auth = useAuth();
Expand Down
2 changes: 1 addition & 1 deletion packages/java/tests/spring/native/frontend/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {createBrowserRouter, RouteObject} from 'react-router-dom';
import {createBrowserRouter, RouteObject} from 'react-router';
import {ChatView} from "Frontend/views/ChatView.js";
import {LoginView} from "Frontend/views/LoginView.js";
import {ReadOnlyGrid} from "Frontend/views/ReadOnlyGrid";
Expand Down
2 changes: 1 addition & 1 deletion packages/java/tests/spring/native/frontend/util/routing.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { useMatches } from 'react-router-dom';
import { useMatches } from 'react-router';

type RouteMetadata = {
[key: string]: any;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { AccessProps, AuthContext } from 'Frontend/useAuth.js';
import { ReactNode, useContext } from 'react';
import { Navigate, useMatches } from 'react-router-dom';
import { Navigate, useMatches } from 'react-router';

export type AuthControlProps = Readonly<{
fallback?: ReactNode;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import Placeholder from 'Frontend/components/placeholder/Placeholder';
import { AuthContext } from 'Frontend/useAuth.js';
import { useRouteMetadata } from 'Frontend/util/routing';
import { Suspense, useContext } from 'react';
import { NavLink, Outlet } from 'react-router-dom';
import { NavLink, Outlet } from 'react-router';

const navLinkClasses = ({ isActive }: any) => {
return `block rounded-m p-s ${isActive ? 'bg-primary-10 text-primary' : 'text-body'}`;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import router from 'Frontend/routes.js';
import { RouterProvider } from 'react-router-dom';
import { RouterProvider } from 'react-router';

export default function App() {
return <RouterProvider router={router} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AppLayout } from '@vaadin/react-components/AppLayout.js';
import { DrawerToggle } from '@vaadin/react-components/DrawerToggle.js';
import { Scroller } from '@vaadin/react-components/Scroller.js';
import { routes } from 'Frontend/routes.js';
import { NavLink, Outlet } from 'react-router-dom';
import { NavLink, Outlet } from 'react-router';

export default function MainLayout() {
const menuRoutes = routes[0]!.children;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createBrowserRouter } from 'react-router-dom';
import { createBrowserRouter } from 'react-router';
import MainLayout from './MainLayout.js';
import { AutoCrudView } from 'Frontend/views/AutoCrudView.js';
import { AutoFormView } from 'Frontend/views/AutoFormView.js';
Expand Down
2 changes: 1 addition & 1 deletion packages/java/tests/spring/react-i18n/frontend/App.tsx
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import router from 'Frontend/routes.js';
import { RouterProvider } from 'react-router-dom';
import { RouterProvider } from 'react-router';

export default function App() {
return <RouterProvider router={router} />;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { AppLayout } from '@vaadin/react-components/AppLayout.js';
import { DrawerToggle } from '@vaadin/react-components/DrawerToggle.js';
import { Scroller } from '@vaadin/react-components/Scroller.js';
import { routes } from 'Frontend/routes.js';
import { NavLink, Outlet } from 'react-router-dom';
import { NavLink, Outlet } from 'react-router';

export default function MainLayout() {
const menuRoutes = routes[0]!.children;
Expand Down
2 changes: 1 addition & 1 deletion packages/java/tests/spring/react-i18n/frontend/routes.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { createBrowserRouter } from 'react-router-dom';
import { createBrowserRouter } from 'react-router';
import MainLayout from './MainLayout.js';
import BasicI18NView from './_views/BasicI18NView';
export const routes = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@

import { createElement } from 'react';
import { createRoot } from 'react-dom/client';
import { RouterProvider } from 'react-router-dom';
import { RouterProvider } from 'react-router';
import { router } from 'Frontend/generated/routes.js';
import { AuthProvider } from 'Frontend/util/auth';

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { Button } from '@vaadin/react-components';
import { useSignal } from '@vaadin/hilla-react-signals';
import { SecureNumberSignalService } from 'Frontend/generated/endpoints.js';
import { useAuth } from 'Frontend/util/auth.js';
import { useNavigate } from 'react-router-dom';
import { useNavigate } from 'react-router';

const userCounter = SecureNumberSignalService.userCounter();
const adminCounter = SecureNumberSignalService.adminCounter();
Expand Down
2 changes: 1 addition & 1 deletion packages/ts/file-router/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,7 @@
"peerDependencies": {
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-router-dom": "^6.28.0"
"react-router": "^7"
},
"devDependencies": {
"@esm-bundle/chai": "^4.3.4-fix.0",
Expand Down
24 changes: 2 additions & 22 deletions packages/ts/file-router/src/runtime/RouterConfigurationBuilder.ts
Original file line number Diff line number Diff line change
@@ -1,12 +1,7 @@
/* eslint-disable @typescript-eslint/consistent-type-assertions */
import { protectRoute } from '@vaadin/hilla-react-auth';
import { type ComponentType, createElement } from 'react';
import {
createBrowserRouter,
type IndexRouteObject,
type NonIndexRouteObject,
type RouteObject,
} from 'react-router-dom';
import { createBrowserRouter, type IndexRouteObject, type NonIndexRouteObject, type RouteObject } from 'react-router';
import { convertComponentNameToTitle } from '../shared/convertComponentNameToTitle.js';
import { transformTree } from '../shared/transformTree.js';
import type {
Expand Down Expand Up @@ -358,22 +353,7 @@ export class RouterConfigurationBuilder {

return {
routes,
router: createBrowserRouter([...routes], {
basename: new URL(document.baseURI).pathname,
future: {
// eslint-disable-next-line camelcase
v7_fetcherPersist: true,
// eslint-disable-next-line camelcase
v7_normalizeFormMethod: true,
// eslint-disable-next-line camelcase
v7_partialHydration: true,
// eslint-disable-next-line camelcase
v7_relativeSplatPath: true,
// eslint-disable-next-line camelcase
v7_skipActionErrorRevalidation: true,
},
...options,
}),
router: createBrowserRouter([...routes], { basename: new URL(document.baseURI).pathname, ...options }),
};
}

Expand Down
4 changes: 2 additions & 2 deletions packages/ts/file-router/src/runtime/useViewConfig.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import type { UIMatch } from '@remix-run/router';
import { useMatches } from 'react-router-dom';
import type { UIMatch } from 'react-router';
import { useMatches } from 'react-router';
import type { ViewConfig } from '../types.js';

/**
Expand Down
2 changes: 1 addition & 1 deletion packages/ts/file-router/src/types.d.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import type { createBrowserRouter, RouteObject } from 'react-router-dom';
import type { createBrowserRouter, RouteObject } from 'react-router';

export type ViewConfig = Readonly<{
/**
Expand Down
5 changes: 0 additions & 5 deletions packages/ts/file-router/test/mocks/react-router-dom.ts

This file was deleted.

Loading
Loading