mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Add always_update as a parameter for a var reactive
Redux. I managed to commit the wrong thing last time; although it was using this and this was done for that.
This commit is contained in:
@@ -76,11 +76,13 @@ class Reactive(Generic[ReactiveType]):
|
||||
def var(
|
||||
cls,
|
||||
default: ReactiveType | Callable[[], ReactiveType],
|
||||
always_update: bool = False,
|
||||
) -> Reactive:
|
||||
"""A reactive variable that doesn't update or layout.
|
||||
|
||||
Args:
|
||||
default: A default value or callable that returns a default.
|
||||
always_update: Call watchers even when the new value equals the old value.
|
||||
|
||||
Returns:
|
||||
A Reactive descriptor.
|
||||
@@ -326,18 +328,21 @@ class var(Reactive[ReactiveType]):
|
||||
Args:
|
||||
default: A default value or callable that returns a default.
|
||||
init: Call watchers on initialize (post mount).
|
||||
always_update: Call watchers even when the new value equals the old value.
|
||||
"""
|
||||
|
||||
def __init__(
|
||||
self,
|
||||
default: ReactiveType | Callable[[], ReactiveType],
|
||||
init: bool = True,
|
||||
always_update: bool = False,
|
||||
) -> None:
|
||||
super().__init__(
|
||||
default,
|
||||
layout=False,
|
||||
repaint=False,
|
||||
init=init,
|
||||
always_update=always_update,
|
||||
)
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user