-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
isReady() returns false right after "await ready()" promise #22
Comments
Also, I have an "onChange" listener which is triggered 6 times even tough there are only 3 notifications and I just did "await notificationsCursorready(). const notificationsUnreadSub = server.subscribe("notifications.unread");
await notificationsUnreadSub.ready();
const notificationsCursor = server.collection('notifications').reactive()
// this is triggered 6 times even tough i just "awaited" for ready()
// and there are only 3 documents.
notificationsCursor.onChange(function (data) {
console.log("n changed ->", notificationsUnreadSub.isReady())
}) |
Can not reproduce your issues, please provide full example code that behaves as you wrote. |
cool, I'll make a bare meteor repo and send it to you, indeed that will make things easier sorry about not have sent you yet, i released that if i only send the Next.js app it might not be enough for you to test and it's not easy to send just the meteor methods, so I'll create a new empty repo and let you know. thank you for the project and your quick responses! |
You are welcome! Hope we will find what is wrong quick enough. |
@aliogaili have implemented this but not released yet. @hems By the way if you wait for ready it means you wait for 'ready' message from the server, it doesn't guarantee that the server will send any data before (actually it does if you use vanilla Meteor or you use custom publications with added() removed() and changed() and have full control of it). I can't tell more without a code. |
Hey @Gregivy I've not changed anything in SimpleDDP, I've been using for a few months now and it is working great. However, we're using it mostly to execute RPC DDP methods. The only thing that I had to do is handle socket connection disconnect more aggressively by forcing setInterval and connect and I used a react component for that. |
@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 :) |
@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 Thanks for the good words :) About PWA, its a good idea, I have also done it several times by hands, so it will definitely be a useful tool. |
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. |
Yes it's been a life saver to be honest, thank you very much for the library! |
I'm using it with Then if users need the server-side part of next.js then they could host on a regular node.js host, but if it's just client, next.js can export just the "static version" which would be suitable for CDN! |
Yeah, I'm using with a PWA created using Static CRA + React MUI hosted on CDN (Surge) connected to a Meteor system/backend. It is a killer combo frankly! That is why I think it is worth creating a boilerplate with this setup. |
The only problem I see is the lack of SEO and that's why we're moving from client-side only app to |
Yeah, I get it. In our case SSR in the client app is not important, we have a landing page where the SSR is needed and we wanted the static site to manage the scale and avoid the server rendering (a.k.a JAMStack). However, in the dashboard/admin, we've used Meteor SSR to handle some custom client bootstrapping code. |
On my current test i have a simple publication which publishes 3 notifications
And that subscription on the client
And this is my console output:
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?
The text was updated successfully, but these errors were encountered: