mirror of
https://github.com/appy-one/acebase-client.git
synced 2026-05-24 22:01:18 -06:00
[GH-ISSUE #50] Properly closing live query #17
Labels
No milestone
No project
No assignees
1 participant
Notifications
Due date
No due date set.
Dependencies
No dependencies set.
Reference: github-starred/acebase-client#17
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "%!s()"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Originally created by @appy-one on GitHub (May 26, 2022).
Original GitHub issue: https://github.com/appy-one/acebase-client/issues/50
Originally assigned to: @appy-one on GitHub.
There currently is no way to stop a realtime query from delivering results, besides if returning
falsein one of the event callbacks. Waiting for a callback to happen might take a long time, so we need way to stop a realtime query upon request.Suggestion:
Discussed in https://github.com/appy-one/acebase/discussions/108
Originally posted by donl May 22, 2022
When a live query is no longer needed, what is the correct way to unsubscribe and destroy it?
@appy-one commented on GitHub (Jun 6, 2022):
This has been added in acebase v1.21.0+ and acebase-client v1.16.0+ (or older version using latest acebase-core)
@TELECI-PROJECT commented on GitHub (Sep 6, 2022):
Hi, I was trying out this today,
this is my setup:
acebase-server@1.11.0
acebase@1.21.7
I was connecting to AceBase server using a web app built on ReactJS with the browser client:
https://cdn.jsdelivr.net/npm/acebase-client@1.17.0/dist/browser.min.js
and I was able to run live query and get updates as described in the documentation.
This is my query:
this.db_listener = db.query('items')
.filter('locationid', '==', mylocationid)
.on('add', (match) => {
console.log("Item ADD");
}).on('remove', (match) => {
console.log("Item REMOVE");
}).on('change', (match) => {
console.log("Item CHANGE");
});
When I'm trying to stop the live query with this:
await this.db_listener.stop();
I see this kind of error in console:
Uncaught (in promise) ReferenceError: socket is not defined
stop browser.min.js:16
stop browser.min.js:16
componentWillUnmount MyComponent.jsx:119
@appy-one commented on GitHub (Sep 8, 2022):
Thanks for reporting, I'll look into it asap
@appy-one commented on GitHub (Dec 19, 2022):
I'm moving this issue to the acebase client repo
@appy-one commented on GitHub (Dec 19, 2022):
Looks like I was too quick to draw - this originally was an
acebaseissue. @TELECI-PROJECT you were have an issue usingacebase-clientv1.17.0 browser dist. Have you updated to the latest version to check if the issue has been resolved in the meantime?@TELECI-PROJECT commented on GitHub (Dec 22, 2022):
Hi, thanks, I don't see any errors in console after updating to the latest version (Acebase Client v1.20 and Acebase v1.27).
@appy-one commented on GitHub (Dec 23, 2022):
Great!