Skip to content

Commit

Permalink
fix(vike-solid-query): fix No QueryClient set & <QueryBoundary>
Browse files Browse the repository at this point in the history
  • Loading branch information
phonzammi committed Sep 25, 2024
1 parent dc7c4d4 commit 5dc3c02
Show file tree
Hide file tree
Showing 9 changed files with 38 additions and 22 deletions.
3 changes: 2 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,8 @@
},
"pnpm": {
"overrides": {
"vike-solid": "link:./packages/vike-solid/"
"vike-solid": "link:./packages/vike-solid/",
"vike-solid-query": "link:./packages/vike-solid-query/"
}
},
"devDependencies": {
Expand Down
2 changes: 1 addition & 1 deletion packages/vike-solid-query/integration/+config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import "vike-solid/config"; // Needed for declaration merging of Config
export default {
name: "vike-solid-query",
require: {
"vike-solid": ">=0.7.3",
"vike-solid": ">=0.7.4",
},
Wrapper: "import:vike-solid-query/__internal/integration/Wrapper:default",
queryClientConfig: {
Expand Down
2 changes: 1 addition & 1 deletion packages/vike-solid-query/integration/Wrapper.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ import { QueryClient, QueryClientProvider } from "@tanstack/solid-query";
import type { JSX } from "solid-js";
import { usePageContext } from "vike-solid/usePageContext";

export default function Wrapper(props: { children: JSX.Element }) {
export default function Wrapper(props: { children?: JSX.Element }) {
const pageContext = usePageContext();
const queryClient = new QueryClient(pageContext.config.queryClientConfig);

Expand Down
25 changes: 18 additions & 7 deletions packages/vike-solid-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,23 @@
"name": "vike-solid-query",
"version": "0.0.1",
"type": "module",
"main": "./dist/src/server.js",
"typings": "dist/src/index.d.ts",
"module": "./dist/src/server.js",
"types": "./dist/src/index.d.ts",
"browser": {
"./dist/src/server.js": "./dist/src/index.js"
},
"exports": {
".": {
"browser": "./dist/src/index.js",
"node": "./dist/src/server.js",
"default": "./dist/src/index.js",
"types": "./dist/src/index.d.ts"
},
"./config": "./dist/integration/+config.js",
"./__internal/integration/Wrapper": "./dist/integration/Wrapper.jsx"
},
"scripts": {
"dev": "rollup -c rollup.config.js --watch",
"dev:typecheck": "tsc --noEmit --watch",
Expand All @@ -26,13 +43,7 @@
"solid-js": "^1.8.22",
"typescript": "^5.6.2",
"vike": "^0.4.196",
"vike-solid": "workspace:*",
"vite": "^5.4.7"
},
"exports": {
".": "./dist/src/index.js",
"./config": "./dist/integration/+config.js",
"./__internal/integration/Wrapper": "./dist/integration/Wrapper.js"
"vike-solid": "workspace:*"
},
"typesVersions": {
"*": {
Expand Down
16 changes: 11 additions & 5 deletions packages/vike-solid-query/rollup.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,21 @@ import dts from "rollup-plugin-dts";
export default [
withSolid({
input: {
"integration/+config": "./integration/+config.ts",
"integration/Wrapper": "./integration/Wrapper.tsx",
"src/server": "./src/index.ts",
},
ssr: true,
external: ["vike-solid/usePageContext"],
external: [],
}),
withSolid({
input: {
"src/index": "./src/index.ts",
},
ssr: false,
external: [],
}),
{
input: ["./integration/+config.ts", "./integration/Wrapper.tsx"],
output: [{ dir: "dist", format: "es", sanitizeFileName: false }],
input: ["./src/index.ts"],
output: [{ dir: "dist/src", format: "es", sanitizeFileName: false }],
plugins: [dts()],
},
];
1 change: 1 addition & 0 deletions packages/vike-solid-query/src/index.ts
Original file line number Diff line number Diff line change
@@ -1 +1,2 @@
export { QueryBoundary } from "./QueryBoundary";
export type { QueryBoundaryProps } from "./QueryBoundary";
5 changes: 2 additions & 3 deletions packages/vike-solid-query/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,11 @@
"jsx": "preserve",
"jsxImportSource": "solid-js",
"allowJs": true,
"types": ["vite/client"],
"isolatedModules": true,
"outDir": "./dist",
"declaration": true,
"skipLibCheck": true,
"rootDir": "./"
},
"include": ["src/*", "global.d.ts"]
}
"include": ["integration/", "types.d.ts"]
}
File renamed without changes.
6 changes: 2 additions & 4 deletions pnpm-lock.yaml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

0 comments on commit 5dc3c02

Please sign in to comment.