eddev 0.2.0-beta.48 → 0.2.0-beta.50
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/serverless-template/_utils/fetch-wordpress-props.ts +4 -1
- package/serverless-template/global.d.ts +6 -1
- package/serverless-template/pages/404.tsx +1 -2
- package/serverless-template/pages/[...slug].tsx +6 -1
- package/serverless-template/pages/_app.tsx +9 -7
- package/serverless-template/pages/index.tsx +1 -1
package/package.json
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
declare global {
|
|
2
2
|
namespace NodeJS {
|
|
3
3
|
interface Process {
|
|
4
|
-
|
|
4
|
+
client: boolean
|
|
5
5
|
serverless: boolean
|
|
6
6
|
dev: boolean
|
|
7
7
|
devUI: boolean
|
|
8
8
|
}
|
|
9
9
|
}
|
|
10
10
|
}
|
|
11
|
+
|
|
12
|
+
module "@manifest/views" {
|
|
13
|
+
export default any
|
|
14
|
+
export const App: any
|
|
15
|
+
}
|
|
@@ -14,7 +14,12 @@ export async function getStaticPaths(): Promise<GetStaticPathsResult> {
|
|
|
14
14
|
|
|
15
15
|
export async function getStaticProps({ params }: GetStaticPropsContext): Promise<GetStaticPropsResult<any>> {
|
|
16
16
|
const result = await fetchWordpressProps((params?.slug as string[]).join("/"))
|
|
17
|
+
if (result.status === 404) {
|
|
18
|
+
return {
|
|
19
|
+
notFound: true,
|
|
20
|
+
}
|
|
21
|
+
}
|
|
17
22
|
return {
|
|
18
|
-
props: result,
|
|
23
|
+
props: result.data,
|
|
19
24
|
}
|
|
20
25
|
}
|
|
@@ -9,20 +9,22 @@ import { DevUILoader } from "eddev/dev-ui/loader"
|
|
|
9
9
|
import { PageMeta } from "../_utils/PageMeta"
|
|
10
10
|
import { withTRPC } from "@trpc/next"
|
|
11
11
|
|
|
12
|
+
let appData: any
|
|
13
|
+
|
|
12
14
|
function Root({ Component, pageProps }: AppProps) {
|
|
13
15
|
const route = useRouter()
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
16
|
+
|
|
17
|
+
if (!appData) appData = pageProps?.appData?.data
|
|
18
|
+
|
|
19
|
+
// const appData = useMemo(() => {
|
|
20
|
+
// return pageProps?.appData?.data
|
|
21
|
+
// }, [])
|
|
18
22
|
|
|
19
23
|
const viewProps = pageProps?.viewData?.data
|
|
20
24
|
|
|
21
25
|
const View = manifest[pageProps.view]
|
|
22
26
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
if (!pageProps.appData) return <div />
|
|
27
|
+
if (!appData) return <div />
|
|
26
28
|
|
|
27
29
|
return (
|
|
28
30
|
<ServerlessAppDataProvider value={appData}>
|