-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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 18 #7617
React 18 #7617
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
Gatsby Cloud Build Reportethereum-org-website-dev 🎉 Your build was successful! See the Deploy preview here. Build Details🕐 Build time: 29m |
@@ -92,7 +92,6 @@ | |||
"minimist": "^1.2.6", | |||
"prettier": "^2.2.1", | |||
"pretty-quick": "^3.1.0", | |||
"react-test-renderer": "^17.0.1", |
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.
not used anymore
@@ -90,7 +91,7 @@ const CalloutBanner: React.FC<IProps> = ({ | |||
<Image | |||
image={image} | |||
alt={alt} | |||
maxImageWidth={maxImageWidth} | |||
maximagewidth={maxImageWidth} |
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 was getting a warning about this prop name and it suggested me to lowercase it.
const [isOpen, setIsOpen] = useState<boolean>(false) | ||
const [feedbackSubmitted, setFeedbackSubmitted] = useState<boolean>(false) | ||
const [isHelpful, setIsHelpful] = useState<boolean | null>(null) | ||
|
||
const location = typeof window !== "undefined" ? window.location.href : "" |
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 line was causing hydration problems. On server side this was generating a different output than in client side.
That is why I moved it into the useEffect
.
@@ -3,7 +3,7 @@ import PropTypes from "prop-types" | |||
import { Helmet } from "react-helmet" | |||
import { useStaticQuery, graphql } from "gatsby" | |||
import { useIntl } from "react-intl" | |||
import { Location } from "@reach/router" | |||
import { useLocation } from "@reach/router" |
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.
Was getting an error on the Location
component that was related with React 18.
The types returned by 'render()' are incompatible between these types.
So, I have changed it to use the recommended approach, by using hooks.
@@ -83,6 +83,7 @@ const StyledEmoji = styled(Emoji)` | |||
` | |||
|
|||
export interface IProps { | |||
children?: React.ReactNode |
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.
children
was removed from React.FC
. DefinitelyTyped/DefinitelyTyped#56210
I'm starting to think about not using React.FC
anymore since it doesn't bring any major benefit tbh. (CRA already removed it form their templates facebook/create-react-app#8177)
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 is interesting, thanks for dropping that link
On my side, the bug with theme switching it's fixed with this 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.
This is looking good to me! Nice job @pettinarip!
Building nicely, code looks good... was hunting and pecking around the site to try and spot any issues and not seeing anything broken.
@@ -83,6 +83,7 @@ const StyledEmoji = styled(Emoji)` | |||
` | |||
|
|||
export interface IProps { | |||
children?: React.ReactNode |
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 is interesting, thanks for dropping that link
const intl = useIntl() | ||
|
||
const desc = description || translateMessageId("site-description", intl) | ||
|
||
const siteTitle = translateMessageId("site-title", intl) | ||
|
||
/* Set canonical URL w/ language path to avoid duplicate content */ |
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.
Nice, thanks for pulling all this logic out of the return statement
Nice, thanks for the review @wackerow. I'll play around a bit more to see if everything is ok and then will merge it. |
Upgrade react to v18.
Description
Upgraded:
react
&react-dom
to v18gatsby
to v4.21.1Location
withuseLocation
hook onPageMetadata
gatsby-plugin-image
to v2.21.0gatsby-plugin-sharp
&gatsby-transformer-sharp
to v4.21.1@chakra-ui/react
to v2embla-carousel-react
to v7gatsby-plugin-mdx
to v3gatsby-plugin-sitemap
&gatsby-remark-autolink-headers
we are already using the latest major: v5focus-trap-react
bumped to v10Not upgraded:
gatsby-theme-i18n
has not been upgraded yetreact-intl
keeping current v3FormattedHTMLMessage
now is included inFormattedMessage
react-select
keep using v4, no breaking changes with React v18 (only the peer dep warning)@types/react-instantsearch-dom
has not been upgraded yet, removing the old one to avoid TS errorsreact-helmet
react-side-effect
has not been updated yet. They are still using an old version that only supports react 17.Other fixes:
FeedbackWidget
- mismatch in hydration stepEmoji
- the underlying libreact-emoji-render
has a mismatch issue in hydration stepsuppressHydrationWarning
in the meanwhile