Router waitOn waits on subscription on every render

前端 未结 2 1123
小鲜肉
小鲜肉 2021-02-10 02:20

I have a route with a waitOn hook that returns a Meteor.subscribe. Every time the route is triggered, I see the spinner from my loadingTemplate

2条回答
  •  闹比i
    闹比i (楼主)
    2021-02-10 02:43

    An alternative answer to the accepted one was posted by mizzao as a comment to this issue under Iron-Router:

    as long as the subscription is hit before the route loads, you can pass it to the router to wait on. I usually put all of my subscriptions - including autorun ones and router-loaded ones - into one file, and give the array of relevant ones to wait on. This is okay even if the global subscriptions change as long as they are stored back in the file's closure.

提交回复
热议问题