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

Each instance has its own dataset? #1

Closed
inzanez opened this issue Jan 30, 2019 · 5 comments
Closed

Each instance has its own dataset? #1

inzanez opened this issue Jan 30, 2019 · 5 comments

Comments

@inzanez
Copy link

inzanez commented Jan 30, 2019

Hi

I've just been scanning through your code. Am I right that although there can be many instances for a single resource, all these instances will store there own data-set internally?

So multiple copies of the same data could be present in the store, assuming that I have two instances with the same page offset & size on the same resource?

@MaxGfeller
Copy link
Contributor

Hi @inzanez!

There can be many instances on a single resource and as long as they use no (or the same) args the data-set is being only kept once.

The getter function for the instance retrieves the desired items from the data-set (or registry as we call it): https://github.com/cyon/vuex-pagination/blob/master/src/createResource.js#L44.

That means the same data will usually not have to be fetched twice.

@inzanez
Copy link
Author

inzanez commented Jan 30, 2019

@MaxGfeller

Ah, I see. And the use of sparse arrays allows to have different paging settings for the different instances. That makes sense. Many thanks!

@inzanez inzanez closed this as completed Jan 30, 2019
@MaxGfeller
Copy link
Contributor

@inzanez Exactly!

@inzanez
Copy link
Author

inzanez commented Jan 30, 2019

@MaxGfeller
Finally gone through your implementation to the full extent. Congratulations, this is really inspiring. I will try to combine that with JsonAPI specifications...:-)

@MaxGfeller
Copy link
Contributor

@inzanez Sweet, let me know if you need help :)

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