Skip to content
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

pg.live.query returns promise, doc claims it's not #536

Open
LordZardeck opened this issue Feb 12, 2025 · 0 comments
Open

pg.live.query returns promise, doc claims it's not #536

LordZardeck opened this issue Feb 12, 2025 · 0 comments

Comments

@LordZardeck
Copy link

https://pglite.dev/docs/live-queries#live-query states the return type is an object with an unsubscribe function. However, the actual request a is a promise of that object.

In addition, why is the return value a promise and not the results property of that object? Needing to await before even being able to unsubscribe is problematic, especially in react. If i'm trying to manually create a subscription, I need to create the listener, and immediately return a function that can cancel the subscription. I can't await something inside a useEffect in react.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant