-
-
Notifications
You must be signed in to change notification settings - Fork 9
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
React router 7 #297
base: main
Are you sure you want to change the base?
React router 7 #297
Conversation
src/session.ts
Outdated
const sessionStorageSymbol = Symbol().toString(); | ||
const sessionSymbol = Symbol().toString(); |
There was a problem hiding this comment.
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
There was a problem hiding this comment.
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)
There was a problem hiding this comment.
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()
returnsfalse
butSymbol().toString() === Symbol().toString()
returnstrue
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 🙏
There was a problem hiding this comment.
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!
Let me know if we should rename |
👋 This is an upgrade for React Router v7
Notable changes:
compilerOptions
requires an higher target for Cloudflare (BigInt64Array)