-
Notifications
You must be signed in to change notification settings - Fork 312
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
error after collection.fetch
because the cache isn't updated
#471
Comments
I not sure but i think that is because you aren't using application fetcher |
Yeah, the problem is the |
Thanks, I understand. Ideally, this would be either mentioned in the docs as something inherent in the design, or marked as a bug. I'm afraid I wouldn't be of that much help there. (Feel free to close the issue as not relevant enough, or keep it around as something needing attention.) |
collection.fetch
because the cache isn't updated
@wvengen I agree with you. When I started with rendr I felt a little bit of that also. Since rendr is just an extension to backbone, the first that come to mind was to use it as a regular backbone model and collection. @saponifi3d probably overriding collection fetch to use collection.app,fetch would probably avoid this problems. What do you think of it? |
@pjanuario I like the idea of someone making the collection.fetch work the way that people would expect. That being said, I'm not sure it's a well-defined behavior because it would be adding caching and we would need some sort of options to bypass caching, since it's good to have but sometimes you don't want it. @wvengen thanks for sharing your solution. I noticed that there is still a gap in that there is no ability to read from the cache in your fetch call. So, even though the data is stored in the collection store, if you call fetch, it'll still hit the API instead of returning the data stored in the collection store. |
I have a situation where the CollectionStore doesn't seem to be updated.
In a search box, I'm updating the search results in-place as follows:
When text is entered in the search input, the new collection is fetched and the view's collection is updated. However, at some point an exception is thrown:
Debugging revealed that the fetch was not (yet?) stored in the collection store's cache. When adding this line at the top of the
success
function, it all works:It seems odd that I need to add something to the cache manually here. Is this a bug, or am I doing something that really isn't intended?
The text was updated successfully, but these errors were encountered: