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 and masenf committed Nov 25, 2024
1 parent 9ebf16c commit b41b1f3
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 b41b1f3

Please sign in to comment.