{"action":"opened","issue":{"url":"https://api.github.com/repos/alanning/meteor-roles/issues/103","labels_url":"https://api.github.com/repos/alanning/meteor-roles/issues/103/labels{/name}","comments_url":"https://api.github.com/repos/alanning/meteor-roles/issues/103/comments","events_url":"https://api.github.com/repos/alanning/meteor-roles/issues/103/events","html_url":"https://github.com/alanning/meteor-roles/issues/103","id":74873771,"number":103,"title":"Make null publication more performant","user":{"login":"dalgard","id":1209018,"avatar_url":"https://avatars.githubusercontent.com/u/1209018?v=3","gravatar_id":"","url":"https://api.github.com/users/dalgard","html_url":"https://github.com/dalgard","followers_url":"https://api.github.com/users/dalgard/followers","following_url":"https://api.github.com/users/dalgard/following{/other_user}","gists_url":"https://api.github.com/users/dalgard/gists{/gist_id}","starred_url":"https://api.github.com/users/dalgard/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/dalgard/subscriptions","organizations_url":"https://api.github.com/users/dalgard/orgs","repos_url":"https://api.github.com/users/dalgard/repos","events_url":"https://api.github.com/users/dalgard/events{/privacy}","received_events_url":"https://api.github.com/users/dalgard/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":0,"created_at":"2015-05-10T09:05:49Z","updated_at":"2015-05-10T09:05:49Z","closed_at":null,"body":"With the `FastRender` package, all null publications are processed on every single request, including simple resource requests. This means that the publish function will be called many times before `this.userId` becomes available, so its performance can be improved a lot:\r\n\r\n```javascript\r\n// roles_server.js\r\nMeteor.publish(null, function () {\r\n  if (this.userId) {\r\n    return Meteor.users.find(this.userId, {\r\n        fields: { roles: 1 }\r\n      });\r\n  }\r\n\r\n  this.ready();\r\n});\r\n```"}}