【发布时间】:2015-02-16 16:11:14
【问题描述】:
onAfterAction 运行两次,一次在数据到达之前,一次在数据到达之后。为什么它在数据到达之前运行?此外,在这个基本版本中,rendered 在数据到达之后被调用,但在我的应用程序中,它在数据到达之前被调用。知道为什么会这样吗?基本再现:
https://github.com/lorensr/waiton-bug
Items = new Meteor.Collection 'items'
Router.configure
waitOn: ->
Meteor.subscribe 'items'
if Meteor.isServer
Meteor.publish 'items', ->
Items.find {}
Router.route '/',
name: 'hello'
【问题讨论】:
-
不应该等待返回一个数组吗?您只需订阅,无需任何返回或数组。
-
您不必返回数组 - 您可以返回单个订阅。
-
对,这个习惯可能是我从旧 API 那里得到的
标签: meteor iron-router