-
Notifications
You must be signed in to change notification settings - Fork 38
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
Data repeat for ever revisit of the component #14
Comments
What if you add |
Adding
to
|
The reason is in that you re-use the same instance of the cursor observable (that comes from the service). I don't know whether it's good or bad, but I'd personally re-recreate new cursor each time with the component for clarity. Though it's fixed now for your case as well. |
…d for every resist
I do not know if this approach is good or bad either, but it is kinda the approach introduced in the repo from which I forked: https://github.com/bsliran/angular2-meteor-base. To me it seem like a fair idea to reuse. I general it seems like at good idea to keep subscriptions open on things you know you want all the time, even though you are not currently showing it. E.g. a facebook-ish app, it seems like a good idea to keep the subscription open to the flow of posts that goes onto the main list of posts, even though you are not currently looking at it, e.g. if you clicked on one of the posts to look at that? I am new to meteor, angular etc, so I do not know about how to do it "the right way". But more importantly, the fix you made does not seem to work. I updated my code to depend on the latest from this repo (see this commit on "repeated data" branch), but the behavior is still that data is repeated for each revisit of the Demo page. |
Because 'prepublish' script is not run when installed from Github. Go to On who stops the observable. It stopes itself when the last subscription unsubscribes from it. |
Seems to solve the problem. Thanks a alot! Any idea when you will create a release including this fix? |
i'll probably add some minor stuff and then ask Uri to release (this week likely). |
In the README you tell how to use the component i Angular2
It seems to me that data will be repeated an extra time for every revisit to this component. That is
bsliran/angular2-meteor-base uses this code-pattern in the DemoComponent. In repeated-data (note branch "repeated-data") I have forked and added an extra component DemoComponent2, and set it up so that you can navigate back and forth between showing DemoComponent and DemoComponent2 (see this commit). After starting the application and pointing your browser to http://localhost:3000, if you click the "Demo"-link you will see data
If then click the "Demo 2"-link, and then the "Demo"-link you will see data
Taking another round and you will see data
I believe it has something to do with meteor-rxjs, but I am not sure. At least the problem does not occur if you are using a hardcoded data-array and no async (see this commit)
Hopefully you can help find out what is going wrong. If it is not a bug, then at least it would be nice if the README of meteor-rxjs under "Usage in Angular 2" mentioned something about this issue, and how to get around it.
The text was updated successfully, but these errors were encountered: