-
Notifications
You must be signed in to change notification settings - Fork 8
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
todo page to index page to todos page, app should not download JSON data again #6
Comments
Reproduced. This seems to be related with the primary key. I'm having the same issue when using the The Data Store expect the Model to have an I'm still not sure whether this is related to the adapter and serializer only, if it's a bug within Ember or a combination of both; but it seems like it could be the configuration for the Web API replacing the PK. One alternative solution would be to get rid of the |
It seems that I can solve the issue really easily by modifying TodoListRoute.js file:
Do you see any problem with the code above? Is it the right pattern? |
I don't think this is it. It may stop the app from calling the backend API every time but in the wrong place; and I think this would essentially do a fraction I'd what the store does. It should be done in the adapter not in the route, and definitely not up for the developer. |
The more I look at it, the more I get convinced it's related to the |
Here's the comments from the ember.js about the caching and state. Looks like it recommended we check the cache and reload ourselves.
The funny thing is that it's not easy to check isLoaded for the array. through the functions. Apparently ember.data still improving on the related functions. For example, the following doesn't work as App.TodoList.isLoaded() always return false due to it needs an id as argument.
The version we have in ember-data.js defines:
I debugged again for App.TodoList.find() by tracing through it, it doesn't seem to check for any isLoaded state before querying for the AJAX result, so it does seem we need to check the cache ourselves. So maybe I should submit a bug for isLoaded function to improve it for id as undefined case to improve it, and we use the following in the route? |
There's something else. I think we should wait a bit because ember-data is close to another revision, and there will be significant changes that's worth to wait until they are in place to fix the adapter. I don't think this is something that should be a concern of the application, should not be the developer's concern to apply a workaround to fix the framework for a given scenario, that's what the adapter is for. I've created a new project only for the adapter, I'll send you ownership/invitation sometime tomorrow. I think the adapter has to be changed by the next version of ember data (either revision 13 or in 1.0) and we test the hell out of it before adding into nuget. Right not it's just the exact same serializer/adapter you have, but I'll be working on it starting tomorrow |
From comment by majco333 in http://www.asp.net/single-page-application/overview/templates/emberjs-template
Try change index page and back to todos page - your app download JSON data again.
You should not store data in the store? How do this?
The text was updated successfully, but these errors were encountered: