simpleddp: isReady() returns false right after "await ready()" promise

On my current test i have a simple publication which publishes 3 notifications

// server pub
Meteor.publish('unread.notifications', () => {
   return Notifications.find({})
}

And that subscription on the client

// client
  const notificationsUnreadSub = server.subscribe("notifications.unread");
  await notificationsUnreadSub.ready();

  const notificationsCursor = server.collection('notifications')
    .reactive()
    
  console.log("is ready ->", notificationsUnreadSub.isReady())
  console.log("data ->", notificationsCursor.data())

And this is my console output:

is ready -> false
unreadNotifications.js:14 data -> (3) [{…}, {…}, {…}]

The unexpected thing is that my console log says “is ready: false” right after the subscription but my “.data()” call returns the only 3 subscriptions that exist.

Is there a reason for the “isReady()” to not be true right after waiting for the promise?

About this issue

  • Original URL
  • State: open
  • Created 4 years ago
  • Comments: 16 (11 by maintainers)

Most upvoted comments

@Gregivy I’m a big fan of SimpleDDP and I’ve been recommending it a lot, so thanks a lot for maintaining it.

I’m thinking of creating a boilerplate on top of SimpleDDP and calling it SimlpePWA. Basically, it’s a React Static PWA app that can be hosted on CDN and communicate with Meteor backend using SimpleDDP.

good stuff!

I have also created a few React Hooks to handle “Subscriptions”, “Methods” and “Login” which i could also share if you guys create such React related templates / project.

@Gregivy I’m a big fan of SimpleDDP and I’ve been recommending it a lot, so thanks a lot for maintaining it.

I’m thinking of creating a boilerplate on top of SimpleDDP and calling it SimlpePWA. Basically, it’s a React Static PWA app that can be hosted on CDN and communicate with Meteor backend using SimpleDDP.

@aliogaili I mean that I have added the maxTimeout support for the connect() method, I will soon publish all new fixes on npm 😃 Its nice to hear that you use simpleddp btw 😃