Skip to content
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
10 changes: 4 additions & 6 deletions reflex/state.py
Original file line number Diff line number Diff line change
Expand Up @@ -2189,14 +2189,12 @@ def dict(
async def __aenter__(self) -> BaseState:
"""Enter the async context manager protocol.

This should not be used for the State class, but exists for
type-compatibility with StateProxy.
This is a no-op for the State class and mainly used in background-tasks/StateProxy.

Raises:
TypeError: always, because async contextmanager protocol is only supported for background task.
Returns:
The unmodified state (self)
"""
msg = "Only background task should use `async with self` to modify state."
raise TypeError(msg)
return self

async def __aexit__(self, *exc_info: Any) -> None:
"""Exit the async context manager protocol.
Expand Down
Loading