流星';当Meteor.publish带有“s”时,乐观的用户界面被破坏;createdAt:{$gte:start,$lt:now}";
故事: 我使用了meteor 1.4和angular 1。我想使用Meteor.publish将“Todo”设置为私有,以下是客户端代码:流星';当Meteor.publish带有“s”时,乐观的用户界面被破坏;createdAt:{$gte:start,$lt:now}";,meteor,angular-meteor,optimistic-ui,Meteor,Angular Meteor,Optimistic Ui,故事: 我使用了meteor 1.4和angular 1。我想使用Meteor.publish将“Todo”设置为私有,以下是客户端代码: var now = new Date(); var start = new Date(); start.setHours(0, 0, 0, 0); this.helpers({ todos() { return Todos.find({createdAt: {$gte: start, $lt: now}, userId: Meteor.use
var now = new Date();
var start = new Date();
start.setHours(0, 0, 0, 0);
this.helpers({
todos() {
return Todos.find({createdAt: {$gte: start, $lt: now}, userId: Meteor.userId()}, {
sort: {
createdAt: -1
}
});
},
currentUser() {
return Meteor.user();
}
});
问题:
当我使用带有“userId”的Meteor.publish
时,todo列表ui运行良好,在我添加一个新的todo后,它可以自动更新ui。但是在我添加了Meteor.publish
createdAt:{$gte:start,$lt:now}过滤器后,我必须刷新(F5)页面,然后才能看到新的todo。以下是服务器端发布代码:
Meteor.publish('todos', function tasksPublication() {
var now = new Date();
var start = new Date();
start.setHours(0, 0, 0, 0);
return Todos.find({createdAt: {$gte: start, $lt: now}, userId: this.userId});
});
有人知道如何修复吗?我已经修复了这个错误。由于我没有深入流星的缓存,下面的原因是我的猜测:
谢谢。我已经修复了这个错误。由于我没有深入流星的缓存,下面的原因是我的猜测: