Skip to content

Commit

Permalink
fix mutable default in EventNamespace (#4420)
Browse files Browse the repository at this point in the history
  • Loading branch information
Lendemor authored Nov 23, 2024
1 parent c7d3876 commit 697e26c
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions reflex/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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):
Expand Down

0 comments on commit 697e26c

Please sign in to comment.