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

Upgrade to React Router v7 #297

Merged
merged 5 commits into from
Dec 5, 2024
Merged

Conversation

rphlmr
Copy link
Contributor

@rphlmr rphlmr commented Nov 23, 2024

👋 This is an upgrade for React Router v7

Notable changes:

  • compilerOptions requires an higher target for Cloudflare (BigInt64Array)

src/session.ts Outdated
Comment on lines 6 to 7
const sessionStorageSymbol = Symbol().toString();
const sessionSymbol = Symbol().toString();
Copy link
Owner

Choose a reason for hiding this comment

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

This has an issue, Symbol() === Symbol() returns false but Symbol().toString() === Symbol().toString() returns true

If Hono doesn't allow symbols anymore, then these needs to be unique strings

Copy link

@lhr0909 lhr0909 Nov 24, 2024

Choose a reason for hiding this comment

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

Tested on my end during react-router v7 migration using this branch and locally patching it back to Symbol(), and verified that Symbol() works just fine. My hono version is v4.6.11 (latest as of now)

Copy link
Contributor Author

Choose a reason for hiding this comment

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

This has an issue, Symbol() === Symbol() returns false but Symbol().toString() === Symbol().toString() returns true

If Hono doesn't allow symbols anymore, then these needs to be unique strings

Good catch!
To be honest, Hono accepts everything derived from Env: { Variables }, but since we don't pass a type to createMiddleware, it falls back to {string: any}.(https://github.com/honojs/hono/blob/bfc190f72573379565f6fab3f290e657f5778044/src/context.ts#L568).
So, I have added an Env type to pass to createMiddleware and I've checked that the user code doesn't complain about it.

I've rolled back my commit with the string key because it can introduce conflicts if someone uses the same keys in their context.

@lhr0909 Symbol works in JS but the issue here is a pure type error. It would be kind if you could test this version and tell me if you have any issues with Context/Env 🙏

Copy link

Choose a reason for hiding this comment

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

@rphlmr I have tested and it works fine on my end. Thank you!

@rphlmr
Copy link
Contributor Author

rphlmr commented Nov 24, 2024

Let me know if we should rename remix to reactRouter

@sergiodxa sergiodxa changed the title React router 7 Upgrade to React Router v7 Dec 5, 2024
@sergiodxa sergiodxa merged commit bc12d09 into sergiodxa:main Dec 5, 2024
4 checks passed
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.

4 participants