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

Delete Reactive.var. #2709

Merged
merged 2 commits into from
Jun 6, 2023
Merged
Show file tree
Hide file tree
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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,13 +45,13 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- Keybinding <kbd>right</kbd> in `Input` is also used to accept a suggestion if the cursor is at the end of the input https://github.com/Textualize/textual/pull/2604
- `Input.__init__` now accepts a `suggester` attribute for completion suggestions https://github.com/Textualize/textual/pull/2604
- Using `switch_screen` to switch to the currently active screen is now a no-op https://github.com/Textualize/textual/pull/2692
- Breaking change: removed `reactive.py::Reactive.var` in favor of `reactive.py::var` https://github.com/Textualize/textual/pull/2709/

### Removed

- `Placeholder.reset_color_cycle`
- Removed `Widget.reset_focus` (now called `Widget.blur`) https://github.com/Textualize/textual/issues/2642


## [0.26.0] - 2023-05-20

### Added
Expand Down
17 changes: 0 additions & 17 deletions src/textual/reactive.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,23 +72,6 @@ def __rich_repr__(self) -> rich.repr.Result:
yield "always_update", self._always_update
yield "compute", self._run_compute

@classmethod
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.
"""
return cls(default, layout=False, repaint=False, init=False)

def _initialize_reactive(self, obj: Reactable, name: str) -> None:
"""Initialized a reactive attribute on an object.

Expand Down