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

Update to React Router v7 #415

Merged
merged 25 commits into from
Dec 4, 2024
Merged

Update to React Router v7 #415

merged 25 commits into from
Dec 4, 2024

Conversation

AlemTuzlak
Copy link
Contributor

@AlemTuzlak AlemTuzlak commented Nov 20, 2024

A lot of issues with this, mainly:
Some types are not exported anymore
The tests fail a lot due to installGlobals missing
The json method has been removed and that kind of changes the dynamic of the whole test suites, and a lot of utils

AlemTuzlak and others added 2 commits November 20, 2024 17:31
Co-authored-by: Sergio Xalambrí <[email protected]>
Co-authored-by: Sergio Xalambrí <[email protected]>
@@ -15,7 +15,7 @@ type ResponseResult<LoaderData> = {
export async function jsonHash<LoaderData extends Record<string, unknown>>(
input: LoaderData,
init?: ResponseInit | number,
): Promise<TypedResponse<ResponseResult<LoaderData>>> {
): Promise<UNSAFE_DataWithResponseInit<ResponseResult<LoaderData>>> {
Copy link
Owner

Choose a reason for hiding this comment

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

I think this could be left for TS to infer it

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah I agree, especially now that TypedResponse got nuked out of existence

import { describe, expect, test } from "vitest";

import { useFetcher } from "@remix-run/react";
import { useFetcher } from "react-router";
Copy link
Owner

Choose a reason for hiding this comment

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

This import can be merged with the react-router import above

Copy link
Contributor Author

Choose a reason for hiding this comment

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

yeah I was using patterns to rename so there might be a few of these around, I think biome can also handle this on it's own if configured, but I might be wrong!

Co-authored-by: Sergio Xalambrí <[email protected]>
@AlemTuzlak
Copy link
Contributor Author

@sergiodxa I hope this helps you a bit to get fully there, I am not familiar with the codebase, especially the test setup, so it's a bit over my head on how to fix it and make it work, I also added some breaking changes by changing json to data, as data from react-router does not return a response at all. If you need any other help or feedback let me know, I can also help deploy it with pkg.pr.new if needed so people can test it before the official release!

@raulfdm
Copy link

raulfdm commented Nov 26, 2024

@sergiodxa sorry to ask that but does this PR has everything already to be merged and shipped? I'm in middle of remix 2 -> react router 7 migration and this package is the last remaining >.<

If you need any help so we can speed this up, please let me (or us) know

@sergiodxa sergiodxa changed the title Initial attempt to add react-router v7 support Update to React Router v7 Dec 4, 2024
@sergiodxa sergiodxa self-assigned this Dec 4, 2024
@sergiodxa sergiodxa added the enhancement New feature or request label Dec 4, 2024
@sergiodxa sergiodxa merged commit 3930d8a into sergiodxa:main Dec 4, 2024
@lodi-g
Copy link

lodi-g commented Dec 6, 2024

Hey, cool to see this coming into remix-utils. Are you planning a new major release?

Right now [email protected] prevents the upgrade to RR7:

npm error Found: [email protected]
npm error node_modules/react-router
npm error   react-router@"^7.0.0" from the root project
npm error   react-router@"6.28.0" from @remix-run/[email protected]
npm error   node_modules/@remix-run/react
npm error     peer @remix-run/react@"^2.15.0" from @remix-run/[email protected]
npm error     node_modules/@remix-run/dev
npm error       peer @remix-run/dev@"^2.15.0" from @remix-run/[email protected]
npm error       node_modules/@remix-run/fs-routes
npm error       1 more (@remix-run/route-config)
npm error     peerOptional @remix-run/react@"^2.0.0" from [email protected]
npm error     node_modules/remix-utils
npm error       remix-utils@"^7.7.0" from the root project
npm error   1 more (react-router-dom)

Thanks!

@sergiodxa
Copy link
Owner

I need to ensure tests pass on main before releasing it.

@greg-hoarau
Copy link

Hey 👋 , do you think you align with the same peerDependencies as React Router for the React version (>=18) ? Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants