Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix mutable default in EventNamespace #4420

Merged
merged 1 commit into from
Nov 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading