File tree 1 file changed +9
-4
lines changed
1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 1
1
import { defer , LoaderFunction , LoaderFunctionArgs } from "@remix-run/node" ;
2
- import { Await , useLoaderData } from "@remix-run/react" ;
2
+ import { Await , useLoaderData , useParams } from "@remix-run/react" ;
3
3
import { NotionAPI } from "notion-client" ;
4
4
import React , { lazy , Suspense } from "react" ;
5
5
import { ClientOnly } from "remix-utils/client-only" ;
@@ -103,6 +103,8 @@ export const loader: LoaderFunction = async ({
103
103
104
104
export default function NotionRoute ( ) {
105
105
const { recordMap } = useLoaderData < typeof loader > ( ) ;
106
+ const { slug } = useParams ( ) ;
107
+ const post = posts . find ( ( p ) => p . slug === slug ) ;
106
108
107
109
return (
108
110
< div className = "flex min-h-screen flex-col" >
@@ -117,9 +119,12 @@ export default function NotionRoute() {
117
119
}
118
120
>
119
121
< Await resolve = { recordMap } >
120
- { ( resolvedRecordMap : ExtendedRecordMap ) => (
121
- < NotionPage recordMap = { resolvedRecordMap } />
122
- ) }
122
+ { ( resolvedRecordMap : ExtendedRecordMap ) => {
123
+ if ( post ) {
124
+ document . title = post . title ;
125
+ }
126
+ return < NotionPage recordMap = { resolvedRecordMap } /> ;
127
+ } }
123
128
</ Await >
124
129
</ Suspense >
125
130
</ div >
You can’t perform that action at this time.
0 commit comments