diff --git a/changelog/entries/unreleased/bug/4520_resolved_a_bug_where_unsubscribing_from_a_baserow_pages_real.json b/changelog/entries/unreleased/bug/4520_resolved_a_bug_where_unsubscribing_from_a_baserow_pages_real.json new file mode 100644 index 0000000000..e681212780 --- /dev/null +++ b/changelog/entries/unreleased/bug/4520_resolved_a_bug_where_unsubscribing_from_a_baserow_pages_real.json @@ -0,0 +1,9 @@ +{ + "type": "bug", + "message": "Resolved a bug where unsubscribing from a Baserow page's realtime events wouldn't work correctly.", + "issue_origin": "github", + "issue_number": 4520, + "domain": "core", + "bullet_points": [], + "created_at": "2026-01-09" +} \ No newline at end of file diff --git a/web-frontend/modules/core/plugins/realTimeHandler.js b/web-frontend/modules/core/plugins/realTimeHandler.js index 91f7237ddf..5bf3f6b9be 100644 --- a/web-frontend/modules/core/plugins/realTimeHandler.js +++ b/web-frontend/modules/core/plugins/realTimeHandler.js @@ -166,12 +166,14 @@ export class RealTimeHandler { this.pages = this.pages.filter( (item) => JSON.stringify(item) !== JSON.stringify({ page, parameters }) ) - this.socket?.send( - JSON.stringify({ - remove_page: page, - ...parameters, - }) - ) + if (this.connected) { + this.socket.send( + JSON.stringify({ + remove_page: page, + ...parameters, + }) + ) + } } /*