Skip to content

Commit 05a1504

Browse files
committed
feat: make subscribe method of autorun's return value, call its callback with the latest value immediately
1 parent 42d25b3 commit 05a1504

File tree

3 files changed

+7
-1
lines changed

3 files changed

+7
-1
lines changed

CHANGELOG.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
# Changelog
22

3+
## Version 0.9.13
4+
5+
- feat: make `subscribe` method of `autorun`'s return value, call its callback with
6+
the latest value immediately
7+
38
## Version 0.9.12
49

510
- feat: add the latest value of `autorun` to the `value` field of its returned value

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "python-redux"
3-
version = "0.9.12"
3+
version = "0.9.13"
44
description = "Redux implementation for Python"
55
authors = ["Sassan Haradji <sassanh@gmail.com>"]
66
license = "Apache-2.0"

redux/main.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -282,6 +282,7 @@ def subscribe(
282282
callback: Callable[[AutorunOriginalReturnType], Any],
283283
) -> Callable[[], None]:
284284
subscriptions.append(callback)
285+
callback(self.value)
285286

286287
def unsubscribe() -> None:
287288
subscriptions.remove(callback)

0 commit comments

Comments
 (0)