We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
I am trying to execute a simple query like: client:
const [users] = useQuery(getUsers, { createdAt: new Date() })
but the query run infinitily I tried
const input= useRef({ createdAt: new Date() }).current const [users,{refetch}] = useQuery(getUsers, input)
Same result! I tried:
const input={ createdAt: new Date() } const Users = () => { const [users,{refetch}] = useQuery(getUsers, input) return ( <> {users?.map((user, i) => ( <div key={i}> {user.name} </div> ))} </> ) }
and that works
It should works at least in the second scenario without problems
client
import { Suspense, useRef, useState } from "react" import Layout from "src/core/layouts/Layout" import { useQuery } from "@blitzjs/rpc" import { BlitzPage } from "@blitzjs/next" import getUsers from "../users/queries/getUsers" const input={ createdAt: new Date() } const Users = () => { const input= useRef({ createdAt: new Date() }).current const [users,{refetch}] = useQuery(getUsers, input) return ( <> <button onClick={() => refetch()}>Refetch</button> {users?.map((user, i) => ( <div key={i}> {user.name} </div> ))} </> ) } const Home: BlitzPage = () => { return ( <Layout title="Home"> <Suspense fallback="Loading..."> <Users /> </Suspense> </Layout> ) } export default Home
server:
import { resolver } from "@blitzjs/rpc" import db from "db" import { z } from "zod" const GetUsers = z.object({ createdAt: z.date() }) export default resolver.pipe( resolver.zod(GetUsers), async ({ createdAt }) => { return await db.user.findMany({ where: { createdAt: { gte: createdAt } } }) } ) ### What are detailed steps to reproduce this?
git clone https://github.com/cesarve77/date-error-blitz.git cd date-error-blitz npm i blitz dev
### Run `blitz -v` and paste the output here:
Blitz version: 2.0.0-beta.31 (global) Blitz version: 2.0.0-beta.31 (local) macOS Ventura | darwin-arm64 | Node: v18.15.0
Package manager: pnpm
System: OS: macOS 13.4.1 CPU: (8) arm64 Apple M1 Memory: 122.16 MB / 16.00 GB Shell: 5.9 - /bin/zsh Binaries: Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node Yarn: 1.22.19 - ~/.nvm/versions/node/v18.15.0/bin/yarn npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm npmPackages: @blitzjs/auth: 2.0.0-beta.31 => 2.0.0-beta.31 @blitzjs/next: 2.0.0-beta.31 => 2.0.0-beta.31 @blitzjs/rpc: 2.0.0-beta.31 => 2.0.0-beta.31 @prisma/client: 4.6.1 => 4.6.1 blitz: 2.0.0-beta.31 => 2.0.0-beta.31 next: 13.4.5 => 13.4.5 prisma: 4.6.1 => 4.6.1 react: 18.2.0 => 18.2.0 react-dom: 18.2.0 => 18.2.0 typescript: ^4.8.4 => 4.8.4 ```
No response
The text was updated successfully, but these errors were encountered:
@cesarve77 I would like a little bit more clarity on this issue, does this happen only you used dates or did you face an infinite loop regardless?
Sorry, something went wrong.
No branches or pull requests
What is the problem?
I am trying to execute a simple query like:
client:
but the query run infinitily
I tried
Same result!
I tried:
and that works
It should works at least in the second scenario without problems
Paste all your error logs here:
Paste all relevant code snippets here:
client
server:
git clone https://github.com/cesarve77/date-error-blitz.git
cd date-error-blitz
npm i
blitz dev
Blitz version: 2.0.0-beta.31 (global)
Blitz version: 2.0.0-beta.31 (local)
macOS Ventura | darwin-arm64 | Node: v18.15.0
Package manager: pnpm
System:
OS: macOS 13.4.1
CPU: (8) arm64 Apple M1
Memory: 122.16 MB / 16.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.15.0 - ~/.nvm/versions/node/v18.15.0/bin/node
Yarn: 1.22.19 - ~/.nvm/versions/node/v18.15.0/bin/yarn
npm: 9.5.0 - ~/.nvm/versions/node/v18.15.0/bin/npm
npmPackages:
@blitzjs/auth: 2.0.0-beta.31 => 2.0.0-beta.31
@blitzjs/next: 2.0.0-beta.31 => 2.0.0-beta.31
@blitzjs/rpc: 2.0.0-beta.31 => 2.0.0-beta.31
@prisma/client: 4.6.1 => 4.6.1
blitz: 2.0.0-beta.31 => 2.0.0-beta.31
next: 13.4.5 => 13.4.5
prisma: 4.6.1 => 4.6.1
react: 18.2.0 => 18.2.0
react-dom: 18.2.0 => 18.2.0
typescript: ^4.8.4 => 4.8.4 ```
Please include below any other applicable logs and screenshots that show your problem:
No response
The text was updated successfully, but these errors were encountered: