Old data unavailable but new one too after DB update

Hi everyone!

I have a problem with my app. My menu display the last sessions available. Each hour a cron job is running to update the last sessions available (in case of a session that happens every wednesday, once the date is passed the cron update to create a new instance of this session but for the next wednesday). The problem is that when a new instance of the session is created, the old one disappears from the menu and the new one does not appears until a refresh…

I think (but I’m maybe wrong) there is a problem with the publications…

Here is my publication:

// User sessionDates
Meteor.publish('sessionDates.currents', function() {
  const userID = this.userId;
  const userSessions = Sessions.find({ "subscribers.userID": userID }, { "_id": 1, "subscribers": 1 });

  let userSessionDatesIds = [];
  userSessions.forEach( function(userSession){ // For all sessions that the user subscribes
    let lastSessionDateID = userSession.sessionDates.pop(); // Get the last available date
    var currentSessionDate = SessionDates.findOne({ "_id": lastSessionDateID.sessionDateID });

  	userSessionDatesIds.push( currentSessionDate["_id"] ); // Add it to the dates to publish

  const userSessionDates = SessionDates.find({
  	"_id" : { $in : userSessionDatesIds }

    return userSessionDates;
  return this.ready();

Here my menu.js

Template.menu.onCreated( function() {
  this.subscribe( 'sessions.all' );
  this.subscribe( 'sessionDates.currents' );

And my menu template

<template name="menu">
	  {{#if Template.subscriptionsReady}}
	  	{{> sessionDates}}

Thanks for any hint or help! :slight_smile: