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

why is force fetch set when starting? #28

Closed
manukall opened this issue Jan 29, 2017 · 4 comments
Closed

why is force fetch set when starting? #28

manukall opened this issue Jan 29, 2017 · 4 comments

Comments

@manukall
Copy link
Contributor

hi,

i'm using the same query in 4 components of my app. this leads to the query being run 4 times when my app loads. i suspect that the following code in SmartQuery is the reason:

if (this.starting) {
  this.options.forceFetch = true
}

so i'm wondering what the purpose of the force fetching is. why is it necessary to set this here?

@Akryum
Copy link
Member

Akryum commented Jan 29, 2017

You are right, this is an error. 🍰

@Akryum Akryum closed this as completed in d9671a6 Jan 29, 2017
@manukall
Copy link
Contributor Author

wow, that was quick. thanks!

also, i'm wondering if you have an opinion on unit testing components that use vue-apollo. right now i'm just not including apollo in my components during tests (i only Vue.use(apollo) when not in the test environment). does that make sense? is there a better approach?

@Akryum
Copy link
Member

Akryum commented Jan 30, 2017

I think it's fine if you inject the data you would normally receive via Apollo. Maybe there are things to do to simulate a request (to test the component behavior with loadingKey changing from 1 to 0 for example).

@manukall
Copy link
Contributor Author

thanks again! i tried stubbing fetch first. that worked as well but was a lot of work for when i wasn't actually testing apollo related things as well. i'm happier with skipping apollo in tests now :-)

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