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] Update gatsby example to use custom plugin #27357

Merged
merged 5 commits into from
Jul 20, 2021

Conversation

mnajdova
Copy link
Member

@mnajdova mnajdova commented Jul 19, 2021

Updates the gatsby example to use a custom plugin.

@mui-pr-bot
Copy link

mui-pr-bot commented Jul 19, 2021

No bundle size changes (experimental)

Generated by 🚫 dangerJS against 29f651e

@mnajdova
Copy link
Member Author

@siriwatknp can you validate that these are the changes done on the store? I noticed that in development mode, SSR is not really working, when I disable JavaScript I see nothing. Production build works as expected. In case these are the only changes done on the store, I will need to dig deeper on why it isn't working.

I didn't add the [gatsby-plugin-material-ui(https://www.gatsbyjs.com/plugins/gatsby-plugin-material-ui/) plugin, so I re-used the same name for the custom plugin. We can consider renaming it so that it avoids confusion, but let's fix the problems first.

@mnajdova mnajdova requested a review from siriwatknp July 19, 2021 15:35
@mnajdova mnajdova marked this pull request as draft July 19, 2021 15:36
@mnajdova mnajdova added the docs Improvements or additions to the documentation label Jul 19, 2021
@siriwatknp
Copy link
Member

siriwatknp commented Jul 20, 2021

can you validate that these are the changes done on the store

Yes, your change is correct. @mnajdova

I noticed that in development mode, SSR is not really working, when I disable JavaScript I see nothing

I think this is also expected. I tried with gatsby starter, also see nothing in development if disable javascript.

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.

👍 Looks good.

@mnajdova mnajdova marked this pull request as ready for review July 20, 2021 08:48
@mnajdova
Copy link
Member Author

I noticed that in development mode, SSR is not really working, when I disable JavaScript I see nothing

I think this is also expected. I tried with gatsby starter, also see nothing in development if disable javascript.

Alright, let's merge and call it a day then :)

@mnajdova mnajdova merged commit a91fc2f into mui:next Jul 20, 2021
@mnajdova
Copy link
Member Author

@oliviertassinari should we ignore the gatsby-theme for now? Looks like it still depends on v4 - https://github.com/hupe1980/gatsby-theme-material-ui/blob/master/packages/material-ui-mdx/package.json

@@ -4,7 +4,7 @@ module.exports = {
'gatsby-plugin-react-helmet',
// If you want to use styled components you should add the plugin here.
// 'gatsby-plugin-styled-components',
'gatsby-plugin-emotion',
Copy link
Member

Choose a reason for hiding this comment

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

Does it mean we can remove "gatsby-plugin-emotion" from the package.json?

Copy link
Member Author

Choose a reason for hiding this comment

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

Ooops, good catch! That's why we need your eyes 😄

import createCache from '@emotion/cache';

export default function getEmotionCache() {
return createCache({ key: 'css', prepend: true });
Copy link
Member

@oliviertassinari oliviertassinari Jul 20, 2021

Choose a reason for hiding this comment

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

In the Next.js example, we don't prepend. What should be our policy?

Copy link
Member Author

Choose a reason for hiding this comment

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

Actually, you are right, we don't need it as in the examples we do not use JSS. Will update it.

@oliviertassinari
Copy link
Member

oliviertassinari commented Jul 20, 2021

should we ignore the gatsby-theme for now? Looks like it still depends on v4 -

@mnajdova It looks like there is this PR: hupe1980/gatsby-theme-material-ui#53. Maybe we should remove the example until it's updated?

No real preferences. Gatsby is not really important. They are getting wrecked by Next.js: https://npm-stat.com/charts.html?package=next,gatsby,react-scripts

@mnajdova
Copy link
Member Author

@mnajdova It looks like there is this PR: hupe1980/gatsby-theme-material-ui#53. Maybe we should remove the example until it's updated?

No real preferences. Gatsby is not really important. They are getting wrecked by Next.js: https://npm-stat.com/charts.html?package=next,gatsby,react-scripts

Let's remove it for now then, to avoid confusion for new developers

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.

4 participants