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

feat: upgrade to react router v7 #416

Merged
merged 1 commit into from
Dec 16, 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
2 changes: 1 addition & 1 deletion .github/workflows/build-remote.js
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ const buildRemote = async () => {
};

if (["react", "vite"].includes(FRAMEWORK)) {
body.answers["router-provider"] = "react-router-v6";
body.answers["router-provider"] = "react-router";
}

const createdBoilerplate = await axios.post(
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-template.js
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ const buildTemplate = async () => {
};

if (["react", "vite"].includes(FRAMEWORK)) {
body.answers["router-provider"] = "react-router-v6";
body.answers["router-provider"] = "react-router";
}

const randomDir = randomString(25);
Expand Down
14 changes: 7 additions & 7 deletions presets.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ module.exports = {
type: "refine-vite",
answers: {
"ui-framework": "antd",
"router-provider": "react-router-v6",
"router-provider": "react-router",
"data-provider": "data-provider-custom-json-rest",
"auth-provider": "none",
"antd-example": "antd-example",
Expand All @@ -18,7 +18,7 @@ module.exports = {
type: "refine-vite",
answers: {
"ui-framework": "no",
"router-provider": "react-router-v6",
"router-provider": "react-router",
"data-provider": "data-provider-custom-json-rest",
"auth-provider": "none",
"antd-example": "no",
Expand All @@ -31,7 +31,7 @@ module.exports = {
type: "refine-vite",
answers: {
"ui-framework": "mui",
"router-provider": "react-router-v6",
"router-provider": "react-router",
"data-provider": "data-provider-custom-json-rest",
"auth-provider": "none",
"antd-example": "no",
Expand All @@ -56,7 +56,7 @@ module.exports = {
type: "refine-vite",
answers: {
"ui-framework": "antd",
"router-provider": "react-router-v6",
"router-provider": "react-router",
"data-provider": "data-provider-supabase",
"antd-example": "no",
"mui-example": "no",
Expand All @@ -68,7 +68,7 @@ module.exports = {
type: "refine-vite",
answers: {
"ui-framework": "no",
"router-provider": "react-router-v6",
"router-provider": "react-router",
"data-provider": "data-provider-supabase",
"antd-example": "no",
"mui-example": "no",
Expand All @@ -80,7 +80,7 @@ module.exports = {
type: "refine-vite",
answers: {
"ui-framework": "antd",
"router-provider": "react-router-v6",
"router-provider": "react-router",
"data-provider": "data-provider-appwrite",
"antd-example": "no",
"mui-example": "no",
Expand All @@ -92,7 +92,7 @@ module.exports = {
type: "refine-vite",
answers: {
"ui-framework": "tailwindcss",
"router-provider": "react-router-v6",
"router-provider": "react-router",
"data-provider": "data-provider-custom-json-rest",
"auth-provider": "none",
"antd-example": "no",
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
import { useBreadcrumb } from "@refinedev/core";
import { Link } from "react-router-dom";
import { Link } from "react-router";

export const Breadcrumb = () => {
const { breadcrumbs } = useBreadcrumb();
Expand Down
2 changes: 1 addition & 1 deletion refine-vite/plugins/_base/src/components/menu/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
<%_ } _%>
useMenu
} from "@refinedev/core";
import { NavLink } from "react-router-dom";
import { NavLink } from "react-router";

export const Menu = () => {
<%_ if (_app.isAuthRoutes) { _%>
Expand Down
2 changes: 1 addition & 1 deletion refine-vite/plugins/headless-example/package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"dependencies": {
"@refinedev/react-hook-form": "^4.8.14",
"@refinedev/react-router-v6": "^4.5.5",
"@refinedev/react-router": "^1.0.0",
"@refinedev/react-table": "^5.6.6",
"@tanstack/react-table": "^8.2.6"
}
Expand Down
5 changes: 0 additions & 5 deletions refine-vite/plugins/react-router-v6/package.json

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
const base = {
_app: {
import: [
`import { BrowserRouter, Route, Routes, Outlet } from "react-router-dom";`,
`import routerBindings, { NavigateToResource, CatchAllNavigate, UnsavedChangesNotifier, DocumentTitleHandler } from "@refinedev/react-router-v6";`
`import { BrowserRouter, Route, Routes, Outlet } from "react-router";`,
`import routerBindings, { NavigateToResource, CatchAllNavigate, UnsavedChangesNotifier, DocumentTitleHandler } from "@refinedev/react-router";`
],
refineProps: [],
},
Expand Down
5 changes: 5 additions & 0 deletions refine-vite/plugins/react-router/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"dependencies": {
"@refinedev/react-router": "^1.0.0"
}
}
8 changes: 4 additions & 4 deletions refine-vite/prompt.js
Original file line number Diff line number Diff line change
Expand Up @@ -153,12 +153,12 @@ module.exports = {
type: "select",
choices: [
{
message: "React Router v6",
name: "react-router-v6",
hint: "React Router v6 will be used as router.",
message: "React Router",
name: "react-router",
hint: "React Router will be used as router.",
},
],
default: "react-router-v6",
default: "react-router",
skip: () => true,
},
{
Expand Down
2 changes: 1 addition & 1 deletion refine-vite/template/_package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
"@refinedev/kbar": "^1.3.6",
"react": "^18.0.0",
"react-dom": "^18.0.0",
"react-router-dom": "^6.8.1"
"react-router": "^7.0.2"
},
"devDependencies": {
"@types/node": "^18.16.2",
Expand Down
Loading