Skip to content

Commit

Permalink
fix transformPageOpts with _app.mdx, pageMap was still included e…
Browse files Browse the repository at this point in the history
…ven it was removed in `transformPageOpts` (#1624)

fix `transformPageOpts` with `_app.mdx`, `pageMap` was still included even it was removed in `transformPageOpts`
  • Loading branch information
Dimitri POSTOLOV authored Mar 10, 2023
1 parent aeec6d4 commit e41cbbc
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
5 changes: 5 additions & 0 deletions .changeset/calm-books-turn.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'nextra': patch
---

fix `transformPageOpts` with _app.mdx, `pageMap` was still included even it was removed in `transformPageOpts`
7 changes: 5 additions & 2 deletions packages/nextra/src/loader.ts
Original file line number Diff line number Diff line change
Expand Up @@ -234,8 +234,8 @@ async function loader(
headings,
hasJsxInH1,
timestamp,
pageMap,
...(!HAS_UNDERSCORE_APP_MDX_FILE && {
pageMap,
flexsearch,
newNextLinkBehavior // todo: remove in v3
}),
Expand Down Expand Up @@ -268,14 +268,17 @@ ${finalResult}
const __nextra_internal__ = globalThis[Symbol.for('__nextra_internal__')] ||= Object.create(null)
__nextra_internal__.Layout = __nextra_layout
__nextra_internal__.pageMap = ${JSON.stringify(pageMap)}
__nextra_internal__.pageMap = ${JSON.stringify(pageOpts.pageMap)}
__nextra_internal__.flexsearch = ${JSON.stringify(flexsearch)}
${
themeConfigImport
? '__nextra_internal__.themeConfig = __nextra_themeConfig'
: ''
}`
}
if (HAS_UNDERSCORE_APP_MDX_FILE) {
delete pageOpts.pageMap
}

const stringifiedPageOpts = JSON.stringify(pageOpts)
const stringifiedChecksum = IS_PRODUCTION
Expand Down

1 comment on commit e41cbbc

@vercel
Copy link

@vercel vercel bot commented on e41cbbc Mar 10, 2023

Choose a reason for hiding this comment

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

Please sign in to comment.