-
Notifications
You must be signed in to change notification settings - Fork 103
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
A single post is not reactive #48
Comments
Maybe something like this would work? Meteor.subscribe('posts.single', postId, () => {
const posts = Collections.Posts.find({ _id: postId }).fetch();
let data = {};
if (posts.length) {
data.post = posts[0];
}
onData(null, data);
}); |
That subscribe callback is running just once anyway. |
Checkout the master branch now. It has a better version. |
Thanks @arunoda ! |
@arunoda Why does the solution work? Is it because the subscription handle is a reactive data source, and it causes the |
@sungwoncho Yes. And it's less code. |
On
post/:postId
, the post on display is not reactive.This may be because
findOne
, used here, does not return a reactive data source. How can we make it reactive?The text was updated successfully, but these errors were encountered: