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

[docs] Update to React 18 #33196

Merged
merged 29 commits into from Jul 8, 2022
Merged

[docs] Update to React 18 #33196

merged 29 commits into from Jul 8, 2022

Conversation

mnajdova
Copy link
Member

@mnajdova mnajdova commented Jun 17, 2022

https://deploy-preview-33196--material-ui.netlify.app/

Things to be resolved before this gets merged:

@mui-bot
Copy link

mui-bot commented Jun 17, 2022

Details of bundle changes

@material-ui/core: parsed: -0.02% 😍, gzip: -0.09% 😍
@material-ui/lab: parsed: -0.03% 😍, gzip: -0.15% 😍
@material-ui/styles: parsed: -0.18% 😍, gzip: -0.89% 😍
@material-ui/system: parsed: -0.13% 😍, gzip: -0.56% 😍
@material-ui/unstyled: parsed: -0.09% 😍, gzip: -0.33% 😍
@material-ui/utils: parsed: -1.46% 😍, gzip: -3.21% 😍
@mui/material-next: parsed: -0.08% 😍, gzip: -0.34% 😍
@mui/joy: parsed: -0.04% 😍, gzip: -0.23% 😍

Generated by 🚫 dangerJS against d2daad5

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 17, 2022
@oliviertassinari
Copy link
Member

cc @Janpot

@Janpot
Copy link
Member

Janpot commented Jun 17, 2022

🤔 Intuitively I'd say all we need to do is spread externals in our wrapper array. We are after all just wrapping the first element. But that may be too naive.

      const [nextExternals, ...externals] = config.externals;

      config.externals = [
        (ctx, callback) => {
          const { request } = ctx;
          const hasDependencyOnRepoPackages = [
            'notistack',
            '@mui/x-data-grid',
            '@mui/x-data-grid-pro',
            '@mui/x-date-pickers',
            '@mui/x-date-pickers-pro',
            '@mui/x-data-grid-generator',
            '@mui/x-license-pro',
          ].some((dep) => request.startsWith(dep));

          if (hasDependencyOnRepoPackages) {
            return callback(null);
          }
          return nextExternals(ctx, callback);
        },
        ...externals,
      ];

@mnajdova
Copy link
Member Author

🤔 Intuitively I'd say all we need to do is spread externals in our wrapper array. We are after all just wrapping the first element. But that may be too naive.

I thought the same, but I am not even sure how to verify that everything works as I don’t know where they come from.

@oliviertassinari
Copy link
Member

I could help test that it works correctly.

Otherwise, It might be good to split the React 18 PRs into multiple chunks. For instance, I see a couple of TypeScript fixes that seem good to take regardless of React 18.

@mnajdova
Copy link
Member Author

Makes sense, will start splitting up the PR into smaller chunks

@Janpot
Copy link
Member

Janpot commented Jun 19, 2022

Looks like this externals configuration is specifically for compiling their new edge runtime, which gets enabled when you use React 18. See https://nextjs.org/docs/advanced-features/react-18/switchable-runtime

As far as I understand, no code in the docs will currently be compiled using this webpack config, so we should be safe here. The code gets run only because the edge runtime compiler gets created. Maybe we could force the nodejs runtime globally, just to be on the safe side.

@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 22, 2022
@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 23, 2022
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jun 23, 2022
@mnajdova mnajdova changed the title [WIP][docs] Update to React 18 [docs] Update to React 18 Jun 23, 2022
@mnajdova
Copy link
Member Author

I noticed that there is one flaky test, it is failing on every second build almost - https://app.circleci.com/pipelines/github/mui/material-ui/75495/workflows/8cd4c2d0-286a-4d39-ab34-6db7dbc51188/jobs/400207

@siriwatknp
Copy link
Member

@mnajdova Please check the Slide test fix 4596433.

Copy link
Member

@siriwatknp siriwatknp left a comment

Choose a reason for hiding this comment

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

👍 LGTM

@github-actions github-actions bot added the PR: out-of-date The pull request has merge conflicts and can't be merged label Jul 6, 2022
@github-actions github-actions bot removed the PR: out-of-date The pull request has merge conflicts and can't be merged label Jul 6, 2022
Copy link
Member

@Janpot Janpot left a comment

Choose a reason for hiding this comment

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

nice

@mnajdova
Copy link
Member Author

mnajdova commented Jul 7, 2022

Sorry for the misleading comment, the fix in mui/mui-x#5414 was enough. I had some local cache that messed up the build. I will wait for the new version of @mui/x-data-grid and will merge this one. Thanks a lot to everyone who helped with the effort :)

@mnajdova mnajdova added the on hold There is a blocker, we need to wait label Jul 7, 2022
@mnajdova mnajdova removed the on hold There is a blocker, we need to wait label Jul 8, 2022
@mnajdova
Copy link
Member Author

mnajdova commented Jul 8, 2022

I am merging this, if we find new issues I will resolve them separately.

@mnajdova mnajdova merged commit 0cdce27 into mui:master Jul 8, 2022
@@ -92,19 +92,19 @@
"lz-string": "^1.4.4",
"markdown-to-jsx": "^7.1.7",
"material-ui-popup-state": "^2.0.1",
"next": "12.1.5",
"next": "12.2.0",
Copy link
Member

Choose a reason for hiding this comment

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

if we find new issues I will resolve them separately.

@mnajdova I have found one. I noticed it on Toolpad, then tried to find the root cause, landing here. I could pinpoint this change to an ocean of warnings in the docs 😁.

Screenshot 2022-07-16 at 00 01 42

I guess it's impacting developers with this demo too https://github.com/mui/material-ui/blob/master/examples/nextjs/src/Link.js.

Copy link
Member

Choose a reason for hiding this comment

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

@mnajdova Found another one while debugging in Netlify, the yarn workspace docs export now spawns a bunch of warnings around the usage of getInitialProps:

warn  - Detected getInitialProps on page '/base/api/badge-unstyled'while running "next export". It's recommended to use getStaticPropswhich has a more correct behavior for static exporting.
Read more: https://nextjs.org/docs/messages/get-initial-props-export

Copy link
Member

Choose a reason for hiding this comment

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

Another regression: the scroll restoration is broken on my end (it's annoying):

I think that it's a regression inside Next.js itself, moving from 12.1.5 to 12.2.0: vercel/next.js#37893.

Copy link
Member Author

Choose a reason for hiding this comment

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

I will try to look into these by the end of the week. If I don't find time I will ask someone in the team to look into them.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
docs Improvements or additions to the documentation
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

8 participants