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

Question: tracking the results of a query on a store #15

Closed
sbrunot opened this issue May 15, 2014 · 4 comments
Closed

Question: tracking the results of a query on a store #15

sbrunot opened this issue May 15, 2014 · 4 comments

Comments

@sbrunot
Copy link

sbrunot commented May 15, 2014

Hi,

I still have trouble to figure out the collection and store tracking detailed specification from the current documentation (that, I understand, is a work in progress), hence my question.

Suppose the following sample code:

var store = ... // Observable store
var result = store.filter(...).sort(...).range(...);
result.track();

after this last line, does result become "live" and is guaranteed to be updated every time
the content of the store is ?

@kriszyp
Copy link
Contributor

kriszyp commented May 22, 2014

To clarify the intent of Observable#track, it is intended by used on the result set prior to the range() requests. The recommended usage would be:

var tracked = store.filter(...).sort(...).track();
var page = tracked.range(...);

We should clarify the API.

@sbrunot
Copy link
Author

sbrunot commented May 28, 2014

@kriszyp Thanks for the clarification.

In your example, does tracked becomes "live" and is guaranteed to be updated every time the content of the store is ? Or should you query the store once again to get the updated data when you receive an update / add / remove notification ?

@kriszyp
Copy link
Contributor

kriszyp commented Jun 6, 2014

To clarify, in my example tracked would be "live" if there is data associated with it (in the case of a Memory store). However, in the case of a Rest store, there would be no data associated with until you did a fetch(), so there would be nothing to keep "live". You shouldn't need to requery after a notification unless the source of the notification didn't provide any information about the index/position of the changes.

@brandonpayton
Copy link
Contributor

@kriszyp and @sbrunot, it appears this has reached a resolution. Can it be closed?

@sbrunot sbrunot closed this as completed Jun 10, 2014
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

3 participants