Skip to content

Commit

Permalink
remove @tanstack/query-core dep from @blitzjs/rpc
Browse files Browse the repository at this point in the history
  • Loading branch information
siddhsuresh committed Dec 29, 2023
1 parent 3c97766 commit 04cea70
Show file tree
Hide file tree
Showing 6 changed files with 9 additions and 7 deletions.
2 changes: 0 additions & 2 deletions packages/blitz-next/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,6 @@
"supports-color": "8.1.1"
},
"peerDependencies": {
"@tanstack/query-core": "*",
"@tanstack/react-query": "*",
"blitz": "2.0.0-beta.36",
"next": "*",
Expand All @@ -47,7 +46,6 @@
},
"devDependencies": {
"@blitzjs/config": "2.0.0-beta.36",
"@tanstack/query-core": "4.24.4",
"@tanstack/react-query": "4.24.4",
"@testing-library/dom": "8.13.0",
"@testing-library/jest-dom": "5.16.3",
Expand Down
2 changes: 1 addition & 1 deletion packages/blitz-next/src/error-boundary.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ export const ErrorBoundary = withRouter(
async componentDidCatch(error: Error, info: React.ErrorInfo) {
if (error instanceof RedirectError) {
debug("Redirecting from ErrorBoundary to", error.url)
void this.props.router.push(error.url)
await this.props.router.push(error.url)
return
}
this.props.onError?.(error, info)
Expand Down
2 changes: 1 addition & 1 deletion packages/blitz-next/src/global.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import {QueryClient} from "@tanstack/react-query"
import type {QueryClient} from "@blitzjs/rpc"

declare global {
var queryClient: QueryClient
Expand Down
4 changes: 3 additions & 1 deletion packages/blitz-next/src/index-server.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,10 @@ import {
installWebpackConfig,
InstallWebpackConfigOptions,
ResolverPathOptions,
DefaultOptions,
dehydrate,
QueryClient,
} from "@blitzjs/rpc"
import {DefaultOptions, dehydrate, QueryClient} from "@tanstack/query-core"
import {IncomingMessage, ServerResponse} from "http"
import {withSuperJsonProps} from "./superjson"
import {ParsedUrlQuery} from "querystring"
Expand Down
3 changes: 2 additions & 1 deletion packages/blitz-next/src/provider.tsx
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import {QueryClientProvider, Hydrate, QueryClient, HydrateOptions} from "@tanstack/react-query"
import {QueryClientProvider, Hydrate} from "@tanstack/react-query"
import type {QueryClient, HydrateOptions} from "@blitzjs/rpc"
import React from "react"

export type BlitzProviderProps = {
Expand Down
3 changes: 2 additions & 1 deletion packages/blitz-rpc/src/query/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,8 @@ export function setQueryData<TInput, TResult, T extends AsyncFunc>(

return new Promise((res) => {
getQueryClient().setQueryData(queryKey, newData)
let result: void | ReturnType<ReturnType<typeof getQueryClient>["invalidateQueries"]>
let result: void | ReturnType<ReturnType<typeof getQueryClient>["invalidateQueries"]> =
undefined
if (opts.refetch) {
result = invalidateQuery(resolver, params)
}
Expand Down

0 comments on commit 04cea70

Please sign in to comment.