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 58dc1e2
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 34 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
27 changes: 19 additions & 8 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 @@ -13,7 +30,7 @@
"peerDependencies": {
"@tanstack/solid-query": ">=5.0.0",
"solid-js": "^1.8.7",
"vike-solid": "workspace:^"
"vike-solid": "0.7.4"
},
"devDependencies": {
"@brillout/release-me": "^0.4.2",
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": "0.7.5"
},
"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";
25 changes: 11 additions & 14 deletions packages/vike-solid-query/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,21 +1,18 @@
{
"compilerOptions": {
"target": "ESNext",
"module": "ESNext",
"moduleResolution": "node",
"strict": true,
"noUncheckedIndexedAccess": true,
"allowSyntheticDefaultImports": true,
"rootDir": "./",
"outDir": "./dist/",
"declaration": true,
"esModuleInterop": true,
"isolatedModules": true,
"lib": ["DOM", "DOM.Iterable", "ES2022"],
"module": "ES2022",
"jsx": "preserve",
"jsxImportSource": "solid-js",
"allowJs": true,
"types": ["vite/client"],
"isolatedModules": true,
"outDir": "./dist",
"declaration": true,
"moduleResolution": "Bundler",
"skipLibCheck": true,
"rootDir": "./"
"strict": true,
"target": "ES2020"
},
"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 58dc1e2

Please sign in to comment.