-
-
Notifications
You must be signed in to change notification settings - Fork 325
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
[examples] Match Material UI v5 compatibility #3906
Conversation
…-toolpad into fix/examples-v5-compat
@@ -141,6 +141,12 @@ function SignInPage(props: SignInPageProps) { | |||
? (new URLSearchParams(window.location.search).get('callbackUrl') ?? '/') | |||
: '/'; | |||
|
|||
const [isClient, setIsClient] = React.useState(false); |
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.
The context should be there serverside.
packages/toolpad-core/package.json
Outdated
@@ -39,7 +40,8 @@ | |||
"scripts": { | |||
"clean": "rimraf build", | |||
"prebuild": "pnpm clean", | |||
"build": "pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files", | |||
"build": "pnpm build:node && pnpm build:stable && pnpm build:types && pnpm build:copy-files && pnpm esmify", | |||
"esmify": "rm -rf ./build/node && rm -rf ./build/*/package.json", |
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.
Next.js resolver gets very confused about these @toolpad/core/*/package.json
files. It loads CJS from pages/_app.tsx
and ESM from pages/auth/signin.tsx
. Forcing the package to be ESM-only solves all issues of double contexts being created.
At least this should unblock us. Will adapt the build script in core with a mode for esm only.
typeof window !== 'undefined' | ||
? (new URLSearchParams(window.location.search).get('callbackUrl') ?? '/') | ||
: '/'; | ||
const router = React.useContext(RouterContext); |
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.
@@ -49,6 +44,7 @@ export default function SignIn({ | |||
return {}; | |||
} catch (error) { | |||
// An error boundary must exist to handle unknown errors | |||
console.log('Is this happening'); |
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.
I think you missed this console log, just saw it :D
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.
I can remove it in the release PR.
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.
Missed that, thanks for catching @apedroferreira :)
AUTH_GITHUB_ID
toGITHUB_CLIENT_ID
in examples to matchcreate-toolpad-app
behaviourSignInPage