Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tanstack v5 #240

Merged
merged 5 commits into from
Oct 31, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions examples/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@
"@rspc/solid-query": "workspace:*",
"@rspc/svelte-query": "workspace:*",
"@rspc/tauri": "workspace:^",
"@tanstack/react-query": "^4.36.1",
"@tanstack/solid-query": "^4.36.1",
"@tanstack/svelte-query": "^4.36.1",
"@tanstack/react-query": "^5.4.3",
"@tanstack/solid-query": "^5.4.3",
"@tanstack/svelte-query": "^5.4.3",
"react": "^18.2.0",
"react-dom": "^18.2.0",
"solid-js": "^1.8.3",
Expand Down
2 changes: 1 addition & 1 deletion examples/astro/src/components/react/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,7 @@ function Example({ name }: { name: string }) {
</button>
<button
onClick={() => sendMsg.mutate("Hello!")}
disabled={sendMsg.isLoading}
disabled={sendMsg.isPending}
>
Send Msg!
</button>
Expand Down
2 changes: 1 addition & 1 deletion examples/astro/src/components/solid/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ function Example({ name }: { name: string }) {
</button>
<button
onClick={() => sendMsg.mutate("Hello!")}
disabled={sendMsg.isLoading}
disabled={sendMsg.isPending}
>
Send Msg!
</button>
Expand Down
2 changes: 1 addition & 1 deletion examples/nextjs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"dependencies": {
"@rspc/client": "workspace:*",
"@rspc/react-query": "workspace:*",
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-query": "^5.4.3",
"next": "^13.5.6",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/nextjs/pages/using-use-mutation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { rspc } from "../src/rspc";
import styles from "../styles/Home.module.css";

const UsingUseMutation: NextPage = () => {
const { mutate, data, isLoading, error } = rspc.useMutation("sendMsg");
const { mutate, data, isPending, error } = rspc.useMutation("sendMsg");

const handleSubmit = async (event: React.FormEvent<HTMLFormElement>) => {
event.preventDefault();
Expand Down Expand Up @@ -33,7 +33,7 @@ const UsingUseMutation: NextPage = () => {
</form>

<p className={styles.description}>
{isLoading && "Loading data ..."}
{isPending && "Loading data ..."}
{data && `Server received message: ${data}`}
{error && JSON.stringify(error)}
</p>
Expand Down
7 changes: 4 additions & 3 deletions examples/nextjs/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
{
"compilerOptions": {
"target": "es5",
"target": "ESNext",
"module": "ESNext",
// Enable node-style module resolution, for things like npm package imports.
"moduleResolution": "Bundler",
"lib": ["dom", "dom.iterable", "esnext"],
"allowJs": true,
"skipLibCheck": true,
"strict": true,
"forceConsistentCasingInFileNames": true,
"noEmit": true,
"esModuleInterop": true,
"module": "esnext",
"moduleResolution": "node",
"resolveJsonModule": true,
"isolatedModules": true,
"jsx": "preserve",
Expand Down
2 changes: 1 addition & 1 deletion examples/vercel/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
"dependencies": {
"@rspc/client": "workspace:*",
"@rspc/react-query": "workspace:*",
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-query": "^5.4.3",
"next": "^13.5.6",
"react": "^18.2.0",
"react-dom": "^18.2.0"
Expand Down
4 changes: 2 additions & 2 deletions examples/vercel/pages/using-use-mutation.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import { rspc } from "../src/rspc";
import styles from "../styles/Home.module.css";

const UsingUseMutation: NextPage = () => {
const { mutate, data, isLoading, error } = rspc.useMutation("sendMsg");
const { mutate, data, isPending, error } = rspc.useMutation("sendMsg");

return (
<div className={styles.container}>
Expand Down Expand Up @@ -33,7 +33,7 @@ const UsingUseMutation: NextPage = () => {
</form>

<p className={styles.description}>
{isLoading && "Loading data ..."}
{isPending && "Loading data ..."}
{data && `Server received message: ${data}`}
{error && JSON.stringify(error)}
</p>
Expand Down
3 changes: 2 additions & 1 deletion packages/query-core/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"version": "1.0.0-rc.3",
"description": "A blazingly fast and easy to use tRPC-like server for Rust.",
"keywords": [],
"module": true,
"author": "Oscar Beaumont",
"license": "MIT",
"main": "dist/index.js",
Expand All @@ -25,7 +26,7 @@
},
"devDependencies": {
"@rspc/client": "workspace:*",
"@tanstack/query-core": "^4.36.1",
"@tanstack/query-core": "^5.4.3",
"tslib": "^2.6.2",
"tsup": "^7.2.0",
"typescript": "^5.2.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
},
"devDependencies": {
"@rspc/client": "workspace:*",
"@tanstack/react-query": "^4.36.1",
"@tanstack/react-query": "^5.4.3",
"@types/react": "^18.2.31",
"react": "^18.2.0",
"tslib": "^2.6.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/react-query/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ export function createReactQueryHooks<P extends rspc.ProceduresDef>() {
keyAndInput,
opts: rawOpts,
}),
[tanstack.hashQueryKey(keyAndInput), opts.enabled ?? true]
[tanstack.hashKey(keyAndInput), opts.enabled ?? true]
);
}

Expand Down
2 changes: 1 addition & 1 deletion packages/solid-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
},
"devDependencies": {
"@rspc/client": "workspace:*",
"@tanstack/solid-query": "^4.36.1",
"@tanstack/solid-query": "^5.4.3",
"rollup": "^4.1.4",
"rollup-preset-solid": "^2.0.1",
"solid-js": "^1.8.3",
Expand Down
13 changes: 4 additions & 9 deletions packages/solid-query/src/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ export function createSolidQueryHooks<P extends rspc.ProceduresDef>() {
rspc.HookOptions<
P,
rspc.QueryOptionsOmit<
tanstack.CreateQueryOptions<
tanstack.SolidQueryOptions<
rspc.inferQueryResult<P, K>,
rspc.inferQueryError<P, K>,
rspc.inferQueryResult<P, K>,
() => [K, rspc.inferQueryInput<P, K>]
[K, rspc.inferQueryInput<P, K>]
>
>
>;
Expand All @@ -29,12 +29,7 @@ export function createSolidQueryHooks<P extends rspc.ProceduresDef>() {
],
opts?: CreateQueryOptions<K>
) {
return tanstack.createQuery<
rspc.inferQueryResult<P, K>,
rspc.inferQueryError<P, K>,
rspc.inferQueryResult<P, K>,
() => [K, rspc.inferQueryInput<P, K>]
>(helpers.useQueryArgs(keyAndInput, opts));
return tanstack.createQuery(() => helpers.useQueryArgs(keyAndInput, opts));
}

type CreateMutationOptions<
Expand All @@ -56,7 +51,7 @@ export function createSolidQueryHooks<P extends rspc.ProceduresDef>() {
K extends rspc.inferMutations<P>["key"] & string,
TContext = unknown
>(key: K | [K], opts?: CreateMutationOptions<K, TContext>) {
return tanstack.createMutation(helpers.useMutationArgs(key, opts));
return tanstack.createMutation(() => helpers.useMutationArgs(key, opts));
}

function createSubscription<
Expand Down
2 changes: 1 addition & 1 deletion packages/svelte-query/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
"devDependencies": {
"@rspc/client": "workspace:*",
"@sveltejs/package": "^2.2.2",
"@tanstack/svelte-query": "^4.36.1",
"@tanstack/svelte-query": "^5.4.3",
"tslib": "^2.6.2",
"typescript": "^5.2.2",
"vitest": "^0.34.6"
Expand Down
6 changes: 4 additions & 2 deletions packages/tsconfig.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
{
"compilerOptions": {
"target": "es2020",
"target": "ESNext",
"module": "ESNext",
// Enable node-style module resolution, for things like npm package imports.
"moduleResolution": "Bundler",
"strict": true,
// "noUnusedLocals": true, // TODO: enable this
// "noUnusedParameters": true, // TODO: enable this
Expand All @@ -9,7 +12,6 @@
"noFallthroughCasesInSwitch": true,
"noUncheckedIndexedAccess": true,
"strictNullChecks": true,
"moduleResolution": "node",
"esModuleInterop": true,
"importHelpers": true,
"skipLibCheck": true,
Expand Down
72 changes: 32 additions & 40 deletions pnpm-lock.yaml

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