Skip to content

isReady() returns false right after "await ready()" promise #22

@hems

Description

@hems

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?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions