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

Pagination #31

Open
tonipepperoni opened this issue Jun 24, 2018 · 9 comments
Open

Pagination #31

tonipepperoni opened this issue Jun 24, 2018 · 9 comments
Labels
discussion enhancement New feature or request help wanted Extra attention is needed
Milestone

Comments

@tonipepperoni
Copy link

will this be supported soon?

@phortx
Copy link
Collaborator

phortx commented Jun 25, 2018

Currently I have no plans, but PRs are welcome :)

@phortx phortx added the enhancement New feature or request label Jun 25, 2018
@phortx phortx added this to the 1.1.0 milestone Jun 25, 2018
@phortx
Copy link
Collaborator

phortx commented Jun 27, 2018

How would you like to have the pagination? As fetch params?

User.fetch({ id: 42 }, { perPage: 8, page: 2}) would be my suggestion. What do you think? :)

@tonipepperoni
Copy link
Author

something like that would be cool. i think it would need to return:
total, perPage, page, lastPage
and have different pagination modes depending on type of connection.

I'll see what i can come up with!

@phortx
Copy link
Collaborator

phortx commented Jun 29, 2018

Thanks for your answer :)

and have different pagination modes depending on type of connection.

Could you specify what this means?

something like that would be cool. i think it would need to return:
total, perPage, page, lastPage

I'm thinking about how we could give that meta information to the developer. Currently the fetch action returns a object with the fetched data. We could change that so that fetch returns an object with meta information. I could think about:

  • total records fetched
  • records perPage
  • current page
  • lastPage
  • query time
  • list of fetched records (what fetch returned before)
const meta = await User.fetch(null, { perPage: 8, page: 2}); // null means no filterting
console.log(meta);
{
  records: 7,
  perPage: 8,
  currentPage: 2,
  lastPage: 2,
  queryTime: 86, // ms
  records: {
    users: [ ... ],
    profiles: [ ... ]
  }
}

We could add more information in the future. For consistency I think the other actions should also return this meta object despite there will be no page information.

@phortx phortx changed the title pagination Pagination Jun 29, 2018
@phortx phortx added help wanted Extra attention is needed discussion labels Jun 29, 2018
@phortx phortx modified the milestones: 1.1.0, 1.0.0 Jun 29, 2018
@colinfindlay-nz
Copy link

I'm going to have a need for this shortly. What would be involved in implementing this - just modifying the queryBuilder?

@phortx
Copy link
Collaborator

phortx commented Aug 8, 2018

Probably. I didn't looked at pagination in depth, so I can't tell currently.

Also I'm really busy currently and can't implement this.

First step would be to introduce pagination in the test schema and setup some specs so implement against.

Then I think the fetch.ts and maybe the vuex actions have to be modified. After that the queryBuilder.ts and maybe the transformer.ts has to be modified.

@colinfindlay-nz
Copy link

I'll have a look and see if we can fit this into our schedule. I also need to be able to return arbitrary data attached to edges - so not sure if this would be a natural extension. Or something we just implement internally.

@phortx
Copy link
Collaborator

phortx commented Aug 8, 2018

Fetching of arbitrary data could be possible via model unrelated custom queries: https://vuex-orm.github.io/vuex-orm-graphql/guide/custom-queries/#model-unrelated-simple-query

@ranguard
Copy link

ranguard commented May 2, 2019

If someone does impliment this, please make generic to also support:

limit and nextToken - eg. AWS AppSync

@phortx phortx mentioned this issue May 15, 2019
10 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

4 participants