Skip to content

Commit eb8af58

Browse files
committed
fix data binding
1 parent 2c52fd7 commit eb8af58

File tree

3 files changed

+10
-2
lines changed

3 files changed

+10
-2
lines changed

CHANGELOG.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,13 @@ All notable changes to this project will be documented in this file.
55
The format is based on [Keep a Changelog](http://keepachangelog.com/)
66
and this project adheres to [Semantic Versioning](http://semver.org/).
77

8+
9+
## [0.53.1] - 2023-03-18
10+
11+
### Fixed
12+
13+
- Fixed issue with data binding
14+
815
## [0.53.0] - 2023-03-18
916

1017
### Added

src/textual/dom.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -278,7 +278,7 @@ def compose(self) -> ComposeResult:
278278
f"Unable to bind data; {reactive.owner.__name__} is not defined on {parent.__class__.__name__}."
279279
)
280280
self._reactive_connect[name] = (parent, reactive)
281-
self._initialize_data_bind()
281+
self.call_later(self._initialize_data_bind)
282282
return self
283283

284284
def _initialize_data_bind(self) -> None:

tests/test_data_bind.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ def compose(self) -> ComposeResult:
2222

2323
async def test_data_binding():
2424
app = DataBindApp()
25-
async with app.run_test():
25+
async with app.run_test() as pilot:
2626

2727
# Check default
2828
assert app.bar == "Bar"
@@ -51,6 +51,7 @@ async def test_data_binding():
5151

5252
# Bind data outside of compose
5353
label2.data_bind(foo=DataBindApp.bar)
54+
await pilot.pause()
5455
# Confirm new binding has propagated
5556
assert label2.foo == "Baz"
5657

0 commit comments

Comments
 (0)