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

[examples] Match Material UI v5 compatibility #3906

Merged
merged 38 commits into from
Aug 9, 2024

Conversation

bharatkashyap
Copy link
Member

@bharatkashyap bharatkashyap commented Aug 8, 2024

  • Update example files to match v5 compatibility updates
  • Change AUTH_GITHUB_ID to GITHUB_CLIENT_ID in examples to match create-toolpad-app behaviour
  • Fix a hydration error when using Pages Router on SignInPage

@bharatkashyap bharatkashyap added the examples Relating to /examples label Aug 8, 2024
@Janpot Janpot mentioned this pull request Aug 8, 2024
6 tasks
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Aug 9, 2024
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Aug 9, 2024
@bharatkashyap bharatkashyap requested a review from Janpot August 9, 2024 08:48
@@ -141,6 +141,12 @@ function SignInPage(props: SignInPageProps) {
? (new URLSearchParams(window.location.search).get('callbackUrl') ?? '/')
: '/';

const [isClient, setIsClient] = React.useState(false);
Copy link
Member

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.

@@ -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",
Copy link
Member

@Janpot Janpot Aug 9, 2024

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);
Copy link
Member

Choose a reason for hiding this comment

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

@Janpot Janpot merged commit 3d3e447 into mui:master Aug 9, 2024
14 checks passed
@@ -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');
Copy link
Member

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

Copy link
Member

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.

Copy link
Member Author

@bharatkashyap bharatkashyap Aug 10, 2024

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 :)

@oliviertassinari oliviertassinari changed the title [examples] Match v5 compatibility [examples] Match Material UI v5 compatibility Aug 23, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
examples Relating to /examples
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants