From fb35456583965345a274f13ac63b098e6f3da659 Mon Sep 17 00:00:00 2001 From: Lendemor Date: Fri, 22 Nov 2024 16:56:14 +0100 Subject: [PATCH] fix mutable default in EventNamespace --- reflex/app.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/reflex/app.py b/reflex/app.py index afc40e3b88..fc8efb4201 100644 --- a/reflex/app.py +++ b/reflex/app.py @@ -1462,10 +1462,10 @@ class EventNamespace(AsyncNamespace): app: App # Keep a mapping between socket ID and client token. - token_to_sid: dict[str, str] = {} + token_to_sid: dict[str, str] # Keep a mapping between client token and socket ID. - sid_to_token: dict[str, str] = {} + sid_to_token: dict[str, str] def __init__(self, namespace: str, app: App): """Initialize the event namespace. @@ -1475,6 +1475,8 @@ def __init__(self, namespace: str, app: App): app: The application object. """ super().__init__(namespace) + self.token_to_sid = {} + self.sid_to_token = {} self.app = app def on_connect(self, sid, environ):