Skip to content

Commit

Permalink
🐛 Fix useRouter with next13 and upgrade deps #1350
Browse files Browse the repository at this point in the history
For some reason the component was behaving as it were inside the /app folder. Fix accordingly to vercel/next.js#42502.
  • Loading branch information
fernandolucchesi committed Nov 24, 2022
1 parent b46343e commit db05d58
Show file tree
Hide file tree
Showing 4 changed files with 92 additions and 83 deletions.
6 changes: 3 additions & 3 deletions web/package.json
Expand Up @@ -48,16 +48,16 @@
"html-entities": "^2.3.2",
"ics": "^2.35.0",
"instantsearch.js": "^4.47.0",
"next": "v13.0.5-canary.6",
"next": "13.0.5",
"next-sanity": "^2.1.0",
"next-sanity-image": "^5.0.0",
"next-seo": "^5.1.0",
"next-transpile-modules": "10.0.0",
"only-allow": "^1.1.1",
"query-string": "^7.1.1",
"raw-body": "^2.5.1",
"react": "^18.1.0",
"react-dom": "^18.1.0",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"react-error-boundary": "^3.1.4",
"react-focus-lock": "^2.9.1",
"react-hook-form": "7.38.0",
Expand Down
6 changes: 3 additions & 3 deletions web/pageComponents/pageTemplates/NewsRoomPage.tsx
Expand Up @@ -10,7 +10,7 @@ import { getIsoFromLocale } from '../../lib/localization'
import { Wrapper, Intro, News, UnpaddedText } from './algoliaPages/components'
import { PaginationContextProvider } from '../shared/search/pagination/PaginationContext'
import type { NewsRoomPageType } from '../../types'
import Seo from '../../pageComponents/shared/Seo'
import Seo from '../shared/Seo'
import { useRef } from 'react'

type NewsRoomTemplateProps = {
Expand All @@ -21,15 +21,15 @@ type NewsRoomTemplateProps = {
}

const NewsRoomPage = ({ isServerRendered = false, locale, pageData, slug }: NewsRoomTemplateProps) => {
const { ingress, title } = pageData || {}
const { ingress, title, seoAndSome } = pageData || {}
const envPrefix = Flags.IS_GLOBAL_PROD ? 'prod' : 'dev'
const isoCode = getIsoFromLocale(locale)
const indexName = `${envPrefix}_NEWS_${isoCode}`
const resultsRef = useRef<HTMLDivElement>(null)

return (
<PaginationContextProvider defaultRef={resultsRef}>
<Seo seoAndSome={pageData?.seoAndSome} slug={slug} pageTitle={title} />
<Seo seoAndSome={seoAndSome} slug={slug} pageTitle={title} />
<main>
<Wrapper>
<Intro ref={resultsRef}>
Expand Down
2 changes: 1 addition & 1 deletion web/pageComponents/shared/Seo.tsx
Expand Up @@ -5,7 +5,7 @@ import getOpenGraphImages from '../../common/helpers/getOpenGraphImages'
import { toPlainText } from '@portabletext/react'
import { PortableTextBlock } from '@portabletext/types'
import { getFullUrl } from '../../common/helpers/getFullUrl'
import { useRouter } from 'next/router'
import { useRouter } from 'next/compat/router'

type SeoProps = {
seoAndSome?: {
Expand Down

0 comments on commit db05d58

Please sign in to comment.