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

Should ngneat/query Cache Pages Instead of Fetching on Each Pagination Click? #178

Open
jon9090 opened this issue May 22, 2024 · 0 comments

Comments

@jon9090
Copy link

jon9090 commented May 22, 2024

Which @ngneat/query-* package(s) are the source of the bug?

query

Is this a regression?

No

Description

I cloned this repository to learn about ngneat/query with pagination.

When I navigated to the pagination example, I clicked "next page" a few times and then went back using the "previous" button. I noticed that each time I clicked a button, ngneat/query invoked the fetchProjects function again. This means that in a real application, it would make a server request every time.

You can see in the picture that each time fetchProjects is called, it logs to the console:

function fetchProjects(nextPage: number) {
  console.log('in fetchProjects: ', nextPage);
  const page = nextPage || 0;
  const pageSize = 10;
  ...

Is this how pagination is supposed to work? Isn't ngneat/query supposed to cache the pages it has already fetched?

image

Please provide a link to a minimal reproduction of the bug

No response

Please provide the exception or error you saw

No response

Please provide the environment you discovered this bug in

No response

Anything else?

No response

Do you want to create a pull request?

No

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

1 participant