From cac1284f919d23412eeaf0b0d8c956e3e32365ba Mon Sep 17 00:00:00 2001 From: Peter Evans Date: Wed, 28 Jan 2026 16:36:38 +0000 Subject: [PATCH] Resolving two issues: 1) in our realTimeHandler, don't unsubscribe the client if the state isn't CONNECTED, if they're re-connecting then it'll throw an error when socket.send is called. 2) For defensive programming purposes, in the table page's beforeDestroy, ensure we have a realtimePage before trying to unsubscribe from it. If we attempt to destroy before mounted happens, then realtimePage is still null. (#4527) --- ...re_unsubscribing_from_a_baserow_pages_real.json | 9 +++++++++ .../modules/core/plugins/realTimeHandler.js | 14 ++++++++------ 2 files changed, 17 insertions(+), 6 deletions(-) create mode 100644 changelog/entries/unreleased/bug/4520_resolved_a_bug_where_unsubscribing_from_a_baserow_pages_real.json 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, + }) + ) + } } /*