Skip to content

Commit 3996332

Browse files
add deprecation warning
1 parent b39e904 commit 3996332

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

nicegui/events.py

+8-2
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@
1919
cast,
2020
)
2121

22-
from . import background_tasks, core
22+
from . import background_tasks, core, helpers
2323
from .awaitable_response import AwaitableResponse
2424
from .dataclasses import KWONLY_SLOTS
2525
from .slot import Slot
@@ -147,7 +147,13 @@ class MultiUploadEventArguments(UiEventArguments):
147147
@dataclass(**KWONLY_SLOTS)
148148
class ValueChangeEventArguments(UiEventArguments):
149149
value: Any
150-
previous_value: Any
150+
previous_value: Any = ...
151+
152+
def __post_init__(self):
153+
# DEPRECATED: previous_value will be required in NiceGUI 3.0
154+
if self.previous_value is ...:
155+
helpers.warn_once('The new event argument `ValueChangeEventArguments.previous_value` is not set. '
156+
'In NiceGUI 3.0 this will raise an error.')
151157

152158

153159
@dataclass(**KWONLY_SLOTS)

0 commit comments

Comments
 (0)