-
-
Notifications
You must be signed in to change notification settings - Fork 137
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
handleQuery not working as expected in acceptance test #174
Comments
This is hard for me to fix/understand since I would have to check the route to see what the store.query is returning ( but you could? ) then I have to see a bit more of what is going on. are you on screenhero? |
This is company code, so I can't show it to you directly unfortunately. Can you point me to a resource where I can find out how to look at the data in store.query? I'm new to Ember :) |
are those models in A tab and B tab and default ( All ) .. basically all the same models? if so you don't need to query again. but for inspection in the route to see what your getting back in the route where you have things like return this.store.findAll('user'); or return this.store.query('user', {name:'Bob'}); you can do this: let promise = this.store.findAll('user');
promise.then( (things)=> {
console.log(things.mapBy('id'));
});
return promise; let promise = this.store.query('user', {name:'Bob'});
promise.then( (things)=> {
console.log(things.mapBy('id'));
});
return promise; |
@danielspaniel what it acts like is the store is being reset after the first click + andThen. The two models that get I used your code above to see the things, and it confirmed that the |
right, that is why i asked if they were the same models. what do the store.findAll and the store.query calls look like ( exactly ) |
This is the entire file with proprietary internals modified. import Ember from 'ember';
export default Ember.Route.extend({
controllerName: 'my_controller',
queryParams: {
my_param: {
refreshModel: true
}
},
model(params) {
if (params.my_param != null) {
return this.store.query('my-model', {my_attribute: params.my_param});
} else {
return this.store.findAll('my-model');
}
}
}); |
Looks like you need way more help than just about FactoryGuy. I hope you see the irony that you are asking for help on your paid project. And I offer to get on screenhero and teach you stuff about ember ( because things look kinda whacky ) , and you say .. no no .. this code is proprietary .. you can't actually look at it. So instead we have to go back and forth on this email thread with me trying to figure it out ( for free ). Now, I don't mind helping out, but if you ask me to help and you can barely show me anything .. it's alittle bit foolish. In any case, my hunch is that you don't need to do the store.query, all you have to do is apply filtering on the models in tab A and B. But without knowing more about what is going on, I just can't tell. |
I have a dashboard with three tabs:
The default tab uses
findAll
and the filtered tabs usequery
on the type field.I'm trying to write a test that does the following:
I have a
TestHelper.handleFindAll
call that sets up 2 models for the main tab. I have twoTestHelper.handleQuery
calls (one for type 'A' and one for type 'B') that usewithParams
andreturnsModels
.When I run the test and click on tab A, I get an error that there are 4 entries on the dashboard instead of 1.
I am using version 2.1.3 of ember-data-factory-guy.
The text was updated successfully, but these errors were encountered: