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

Bi-directional infinite query will not fetch previous page if initial prevCursor is null #8330

Open
Apestein opened this issue Nov 23, 2024 · 4 comments

Comments

@Apestein
Copy link

Apestein commented Nov 23, 2024

Describe the bug

Bi-directional infinite query will not fetch previous page if initial prevCursor is null. Sorry but I can't be more descriptive. Please see the codesandbox link provided.

Your minimal, reproducible example

git clone https://github.com/Apestein/apestein-react-infinite-scroller.git
bun install
git checkout tanstack-query-bug
bun run dev
go to app called "demo" localhost:3002

Steps to reproduce

Observe the behavior of the infinite scroll container on the right, which is a bi-directional infinite scroll component. It will work as intended (scroll to 49, then scroll back). Now uncomment line 18 in the actions.ts file. Now inverse scrolling will no longer work (scroll to 49 then try to scroll back).
The intended behavior is for pageParam 0 to be the last page, meaning 0 is the last number that will appear. Maybe I'm not seeing something but I think this is a bug.

Expected behavior

The intended behavior is for pageParam 0 to be the last page, meaning 0 is the last number that will appear. Maybe I'm not seeing something but I think this is a bug.

How often does this bug happen?

Every time

Screenshots or Videos

No response

Platform

OS: ubuntu linux
Browser: chrome

Tanstack Query adapter

None

TanStack Query version

v5.60.2

TypeScript version

v5

Additional context

No response

@TkDodo
Copy link
Collaborator

TkDodo commented Nov 23, 2024

the sandbox is inaccessible - likely because it’s private or in your drafts. Please make it public

@Apestein
Copy link
Author

the sandbox is inaccessible - likely because it’s private or in your drafts. Please make it public

my bad, it's fixed

@TkDodo
Copy link
Collaborator

TkDodo commented Nov 24, 2024

still doesn’t work for me trying to start it up. Stackblitz is so much better these days :/

 *  Executing task: CodeSandbox: dev 

yarn run v1.22.19
$ turbo dev

Attention:
Turborepo now collects completely anonymous telemetry regarding usage.
This information is used to shape the Turborepo roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://turbo.build/repo/docs/telemetry

turbo 2.3.1

 WARNING  Issues occurred when constructing package graph. Turbo will function, but some features may not be available:
   × could not resolve workspaces
  ╰─▶ cannot find binary path: bun

• Packages in scope: @repo/eslint-config, @repo/typescript-config, @repo/ui, demo, docs, web
• Running dev in 6 packages
• Remote caching disabled
  × unable to find package manager binary: cannot find binary path
  ╰─▶ cannot find binary path

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

 *  The terminal process failed to launch (exit code: 1). 
 *  Terminal will be reused by tasks, press any key to close it. 

@Apestein
Copy link
Author

still doesn’t work for me trying to start it up. Stackblitz is so much better these days :/

 *  Executing task: CodeSandbox: dev 

yarn run v1.22.19
$ turbo dev

Attention:
Turborepo now collects completely anonymous telemetry regarding usage.
This information is used to shape the Turborepo roadmap and prioritize features.
You can learn more, including how to opt-out if you'd not like to participate in this anonymous program, by visiting the following URL:
https://turbo.build/repo/docs/telemetry

turbo 2.3.1

 WARNING  Issues occurred when constructing package graph. Turbo will function, but some features may not be available:
   × could not resolve workspaces
  ╰─▶ cannot find binary path: bun

• Packages in scope: @repo/eslint-config, @repo/typescript-config, @repo/ui, demo, docs, web
• Running dev in 6 packages
• Remote caching disabled
  × unable to find package manager binary: cannot find binary path
  ╰─▶ cannot find binary path

error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.

 *  The terminal process failed to launch (exit code: 1). 
 *  Terminal will be reused by tasks, press any key to close it. 

Can't it working on codesandbox/stackbiltz. Instead
git clone https://github.com/Apestein/apestein-react-infinite-scroller.git
bun install
git checkout tanstack-query-bug
bun run dev
go to app called "demo" localhost:3002
Observe the behavior of the infinite scroll container on the right, which is a bi-directional infinite scroll component. It will work as intended (scroll to 49, then scroll back). Now uncomment line 18 in the actions.ts file. Now inverse scrolling will no longer work (scroll to 49 then try to scroll back).
The intended behavior is for pageParam 0 to be the last page, meaning 0 is the last number that will appear. Maybe I'm not seeing something but I think this is a bug.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants