[RESOLVED] Subscriptions not updated

I have a collection of sessions where people can be added. So I publish to the users of one session the list of the others users that shared the same session.

Meteor.publish("users.all", function () {

  const userID = this.userId;
  const userSessions = Sessions.find({
  	"subscribers.userID": userID

  let usersToSubscribe = [];
  userSessions.forEach( function(oneSession){
    usersToSubscribe = usersToSubscribe.concat( _.pluck(oneSession.subscribers, 'userID') );

  const allUsers = Meteor.users.find({
    "_id": { $in: usersToSubscribe }
  }, {
    fields: Users.publicFields,

	   return allUsers;
	return this.ready();

And I subscribe on the router

Router.route('/session/:_ID/share', {
    name: 'session.share',
    template: 'share',
    waitOn: function () {
      return [
        this.subscribe( 'sessions.all' ),
        this.subscribe( 'sessionDates.currents' ),
        this.subscribe( 'roles.all' ),
        this.subscribe( 'users.all' )
    data: function () {
      if (this.ready()) {

But when a user is added to the session, the subscription is not refreshed. What is the problem? :thinking:
Thanks for your help!!

Publications are not reactive. When your sessions collection changes, there is noting to tell the publication to rerun or to publish the new data. You’ll need to use a package like reywood:publish-composite to accomplish what you wish to do here.


Huuummmm true ! The client cannot know that there is a new user…
OK I will look to those reactive publications :wink: