Blitz: useInfiniteQuery cache is broken

Created on 19 Oct 2020  Â·  6Comments  Â·  Source: blitz-js/blitz

What is the problem?

Since v0.24.0 the cache brakes when using useInfiniteQuery(). In my app I’ve a sidebar where you can switch between projects by navigating through: projects/[id]. This is basically the same page but the id in the route changes and the page should query new items based on that id.

After a discussion on Slack with @johncantrell97 & @flybayer we discovered that useQuery() works fine but useInfiniteQuery() doesn't.

Steps to Reproduce

  1. use useInfiniteQuery() and switch between pages where a param changes.

Versions

macOS Catalina | darwin-x64 | Node: v12.18.0

blitz: 0.24.2 (global)
blitz: 0.24.2 (local)

  Package manager: yarn
  System:
    OS: macOS 10.15.4
    CPU: (16) x64 Intel(R) Core(TM) i9-9880H CPU @ 2.30GHz
    Memory: 442.15 MB / 16.00 GB
    Shell: 5.7.1 - /bin/zsh
  Binaries:
    Node: 12.18.0 - ~/.nvm/versions/node/v12.18.0/bin/node
    Yarn: 1.21.1 - /usr/local/bin/yarn
    npm: 6.14.4 - ~/.nvm/versions/node/v12.18.0/bin/npm
    Watchman: 4.9.0 - /usr/local/bin/watchman
  npmPackages:
    @prisma/cli: 2.7.1 => 2.7.1
    @prisma/client: 2.7.1 => 2.7.1
    blitz: 0.24.2 => 0.24.2
    react: 0.0.0-experimental-94c0244ba => 0.0.0-experimental-94c0244ba
    react-dom: 0.0.0-experimental-94c0244ba => 0.0.0-experimental-94c0244ba
    typescript: 3.8.3 => 3.8.3
kinbug statudone

Most helpful comment

Fixed in 0.25.0-canary.1

All 6 comments

@gielcobben can you please upgrade react and react-dom to 0.0.0-experimental-4ead6b530 and see if you still have this bug?

@flybayer Yes, still having this issue.

@gielcobben So sorry for the delay on this!

I highly suspect this is the same problem as #1282 which I tracked down to a bug in react-query that broke in 2.7.0: https://github.com/tannerlinsley/react-query/issues/1160

Workaround is add this to package.json and then run yarn again

  "resolutions": {
    "react-query": "2.6.0"
  },

Can you try that and report back?

No problem man.

Nothing changes when adding react-query 2.6.0. When switching pages the result stays the same when using useInfiniteQuery.

Hello,

I humbly request that I be unsubscribed from your mailing list, I receive
too many emails from you which are of no use to me. I would appreciate if
my request is taken into consideration ASAP.

KIND REGARDS

On Tue, Oct 27, 2020, 2:00 AM Brandon Bayer notifications@github.com
wrote:

@gielcobben https://github.com/gielcobben So sorry for the delay on
this!

I highly suspect this is the same problem as #1282
https://github.com/blitz-js/blitz/issues/1282 which I tracked down to a
bug in react-query that broke in 2.7.0: tannerlinsley/react-query#1160
https://github.com/tannerlinsley/react-query/issues/1160

Workaround is add this to package.json and then run yarn again

"resolutions": {
"react-query": "2.6.0"
},

Can you try that and report back?

—
You are receiving this because you are subscribed to this thread.
Reply to this email directly, view it on GitHub
https://github.com/blitz-js/blitz/issues/1365#issuecomment-716909363,
or unsubscribe
https://github.com/notifications/unsubscribe-auth/AM6EMU5MKXHHWWXTIZDR7JDSMYLTFANCNFSM4SV7G72Q
.

Fixed in 0.25.0-canary.1

Was this page helpful?
0 / 5 - 0 ratings

Related issues

simonedelmann picture simonedelmann  Â·  3Comments

svobik7 picture svobik7  Â·  3Comments

MrLeebo picture MrLeebo  Â·  5Comments

flybayer picture flybayer  Â·  4Comments

SharadKumar picture SharadKumar  Â·  3Comments