copy background task marker (#3255)

This commit is contained in:
benedikt-bartscher 2024-05-08 22:31:20 +02:00 committed by GitHub
parent bdcbe006a2
commit 38c46ec4d5
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -39,6 +39,7 @@ from redis.asyncio import Redis
from reflex import constants
from reflex.base import Base
from reflex.event import (
BACKGROUND_TASK_MARKER,
Event,
EventHandler,
EventSpec,
@ -579,6 +580,8 @@ class BaseState(Base, ABC, extra=pydantic.Extra.allow):
closure=fn.__closure__,
)
newfn.__annotations__ = fn.__annotations__
if mark := getattr(fn, BACKGROUND_TASK_MARKER, None):
setattr(newfn, BACKGROUND_TASK_MARKER, mark)
return newfn
@staticmethod