@@ -41,7 +41,7 @@ import styles from './styles.module.css'
4141// -----------------------------------------------------------------------------
4242
4343const Code = dynamic ( ( ) =>
44- import ( 'react-notion-x/build/ third-party/code' ) . then ( async ( m ) => {
44+ import ( 'react-notion-x/third-party/code' ) . then ( async ( m ) => {
4545 // add / remove any prism syntaxes here
4646 await Promise . allSettled ( [
4747 // @ts -expect-error Ignore prisma types
@@ -112,22 +112,20 @@ const Code = dynamic(() =>
112112)
113113
114114const Collection = dynamic ( ( ) =>
115- import ( 'react-notion-x/build/third-party/collection' ) . then (
116- ( m ) => m . Collection
117- )
115+ import ( 'react-notion-x/third-party/collection' ) . then ( ( m ) => m . Collection )
118116)
119117const Equation = dynamic ( ( ) =>
120- import ( 'react-notion-x/build/ third-party/equation' ) . then ( ( m ) => m . Equation )
118+ import ( 'react-notion-x/third-party/equation' ) . then ( ( m ) => m . Equation )
121119)
122120const Pdf = dynamic (
123- ( ) => import ( 'react-notion-x/build/ third-party/pdf' ) . then ( ( m ) => m . Pdf ) ,
121+ ( ) => import ( 'react-notion-x/third-party/pdf' ) . then ( ( m ) => m . Pdf ) ,
124122 {
125123 ssr : false
126124 }
127125)
128126const Modal = dynamic (
129127 ( ) =>
130- import ( 'react-notion-x/build/ third-party/modal' ) . then ( ( m ) => {
128+ import ( 'react-notion-x/third-party/modal' ) . then ( ( m ) => {
131129 m . Modal . setAppElement ( '.notion-viewport' )
132130 return m . Modal
133131 } ) ,
@@ -188,6 +186,21 @@ const propertyTextValue = (
188186 return defaultFn ( )
189187}
190188
189+ const notionRendererComponents : Partial < NotionComponents > = {
190+ nextLegacyImage : Image ,
191+ nextLink : Link ,
192+ Code,
193+ Collection,
194+ Equation,
195+ Pdf,
196+ Modal,
197+ Tweet,
198+ Header : NotionPageHeader ,
199+ propertyLastEditedTimeValue,
200+ propertyTextValue,
201+ propertyDateValue
202+ }
203+
191204export function NotionPage ( {
192205 site,
193206 recordMap,
@@ -197,24 +210,6 @@ export function NotionPage({
197210 const router = useRouter ( )
198211 const lite = useSearchParam ( 'lite' )
199212
200- const components = React . useMemo < Partial < NotionComponents > > (
201- ( ) => ( {
202- nextLegacyImage : Image ,
203- nextLink : Link ,
204- Code,
205- Collection,
206- Equation,
207- Pdf,
208- Modal,
209- Tweet,
210- Header : NotionPageHeader ,
211- propertyLastEditedTimeValue,
212- propertyTextValue,
213- propertyDateValue
214- } ) ,
215- [ ]
216- )
217-
218213 // lite mode is for oembed
219214 const isLiteMode = lite === 'true'
220215
@@ -250,8 +245,6 @@ export function NotionPage({
250245 [ block , recordMap , isBlogPost ]
251246 )
252247
253- const footer = React . useMemo ( ( ) => < Footer /> , [ ] )
254-
255248 if ( router . isFallback ) {
256249 return < Loading />
257250 }
@@ -314,7 +307,7 @@ export function NotionPage({
314307 pageId === site . rootNotionPageId && 'index-page'
315308 ) }
316309 darkMode = { isDarkMode }
317- components = { components }
310+ components = { notionRendererComponents }
318311 recordMap = { recordMap }
319312 rootPageId = { site . rootNotionPageId }
320313 rootDomain = { site . domain }
@@ -330,7 +323,7 @@ export function NotionPage({
330323 mapImageUrl = { mapImageUrl }
331324 searchNotion = { config . isSearchEnabled ? searchNotion : undefined }
332325 pageAside = { pageAside }
333- footer = { footer }
326+ footer = { < Footer /> }
334327 />
335328
336329 < GitHubShareButton />
0 commit comments