From 3bc85e68ac8cf7ff823f24d8f8d44f9ed775f64a Mon Sep 17 00:00:00 2001 From: Muhammad Date: Sat, 28 Dec 2024 15:45:48 +0700 Subject: [PATCH] test --- examples/full/package.json | 3 +++ examples/full/pages/+config.ts | 3 ++- examples/full/pages/index/+Page.tsx | 5 +++++ packages/vike-react-antd/Wrapper.server.tsx | 5 ++--- pnpm-lock.yaml | 9 +++++++++ 5 files changed, 21 insertions(+), 4 deletions(-) diff --git a/examples/full/package.json b/examples/full/package.json index 6661629f..80bb1713 100644 --- a/examples/full/package.json +++ b/examples/full/package.json @@ -5,9 +5,11 @@ "preview": "vite build && vite preview" }, "dependencies": { + "@ant-design/cssinjs": "^1.22.1", "@types/react": "^18.3.3", "@types/react-dom": "^18.3.0", "@vitejs/plugin-react": "^4.3.1", + "antd": "^5.22.5", "node-fetch": "^3.3.2", "react": "^18.3.1", "react-dom": "^18.3.1", @@ -15,6 +17,7 @@ "typescript": "^5.5.4", "vike": "^0.4.203", "vike-react": "^0.5.11", + "vike-react-antd": "^0.0.0", "vite": "^5.4.0" }, "type": "module" diff --git a/examples/full/pages/+config.ts b/examples/full/pages/+config.ts index 05d71c61..6f411159 100644 --- a/examples/full/pages/+config.ts +++ b/examples/full/pages/+config.ts @@ -2,6 +2,7 @@ export { config } import type { Config } from 'vike/types' import vikeReact from 'vike-react/config' +import vikeReactAntd from 'vike-react-antd/config' // Default configs (can be overridden by pages) const config = { @@ -14,5 +15,5 @@ const config = { bodyAttributes: { class: 'dark' }, viewport: 999, // https://vike.dev/extends - extends: vikeReact, + extends: [vikeReact, vikeReactAntd], } satisfies Config diff --git a/examples/full/pages/index/+Page.tsx b/examples/full/pages/index/+Page.tsx index e909569b..bc2a45ac 100644 --- a/examples/full/pages/index/+Page.tsx +++ b/examples/full/pages/index/+Page.tsx @@ -4,6 +4,7 @@ import React from 'react' import { Counter } from '../../components/Counter' import image from '../../assets/logo-new.svg' import { Config } from 'vike-react/Config' +import { Button, Flex } from "antd"; function Page() { // Will be printed on the server and in the browser: @@ -20,6 +21,10 @@ function Page() { Interactive. + + + + ) } diff --git a/packages/vike-react-antd/Wrapper.server.tsx b/packages/vike-react-antd/Wrapper.server.tsx index 12c26bbb..d6a5718e 100644 --- a/packages/vike-react-antd/Wrapper.server.tsx +++ b/packages/vike-react-antd/Wrapper.server.tsx @@ -7,14 +7,13 @@ import { usePageContext } from 'vike-react/usePageContext' function Wrapper({ children }: { children: ReactNode }) { const pageContext = usePageContext() const { antd } = pageContext.config - const cache = 'antd' in pageContext ? pageContext.antd?.cache : undefined - if (antd === null || !cache) { + if (antd === null) { return <>{children} } return ( - + {children} ) diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 4286aca0..71ad8489 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -77,6 +77,9 @@ importers: examples/full: dependencies: + '@ant-design/cssinjs': + specifier: ^1.22.1 + version: 1.22.1(react-dom@18.3.1(react@18.3.1))(react@18.3.1) '@types/react': specifier: ^18.3.3 version: 18.3.3 @@ -86,6 +89,9 @@ importers: '@vitejs/plugin-react': specifier: ^4.3.1 version: 4.3.1(vite@5.4.0(@types/node@20.11.17)) + antd: + specifier: ^5.22.5 + version: 5.22.5(react-dom@18.3.1(react@18.3.1))(react@18.3.1) node-fetch: specifier: ^3.3.2 version: 3.3.2 @@ -107,6 +113,9 @@ importers: vike-react: specifier: link:../../packages/vike-react version: link:../../packages/vike-react + vike-react-antd: + specifier: link:../../packages/vike-react-antd + version: link:../../packages/vike-react-antd vite: specifier: ^5.4.0 version: 5.4.0(@types/node@20.11.17)