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 CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "eddev",
3
- "version": "0.2.0-beta.48",
3
+ "version": "0.2.0-beta.50",
4
4
  "main": "./index.js",
5
5
  "license": "MIT",
6
6
  "bin": {
@@ -42,5 +42,8 @@ export async function fetchWordpressProps(pathname: string) {
42
42
  return url
43
43
  })
44
44
 
45
- return JSON.parse(text)
45
+ return {
46
+ status: response.status,
47
+ data: JSON.parse(text),
48
+ }
46
49
  }
@@ -1,10 +1,15 @@
1
1
  declare global {
2
2
  namespace NodeJS {
3
3
  interface Process {
4
- browser: boolean
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
+ }
@@ -6,8 +6,7 @@ export default function Home() {
6
6
 
7
7
  export async function getStaticProps({ params }: any) {
8
8
  const result = await fetchWordpressProps("/404")
9
- console.log("404", result)
10
9
  return {
11
- props: result,
10
+ props: result.data,
12
11
  }
13
12
  }
@@ -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
- console.log("Route", route)
15
- const appData = useMemo(() => {
16
- return pageProps?.appData?.data
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
- console.log("Page Props", pageProps)
24
-
25
- if (!pageProps.appData) return <div />
27
+ if (!appData) return <div />
26
28
 
27
29
  return (
28
30
  <ServerlessAppDataProvider value={appData}>
@@ -7,6 +7,6 @@ export default function Home() {
7
7
  export async function getStaticProps({ params }: any) {
8
8
  const result = await fetchWordpressProps("/")
9
9
  return {
10
- props: result,
10
+ props: result.data,
11
11
  }
12
12
  }