Skip to content

Commit 8aea613

Browse files
committed
refactor: autorun doesn't inform subscribers when the output value is not changed
1 parent 546527c commit 8aea613

File tree

2 files changed

+4
-1
lines changed

2 files changed

+4
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
## Upcoming
44

55
- refactor: remove `WithState` as it wasn't doing anything beyond `functools.wraps`
6+
- refactor: autorun doesn't inform subscribers when the output value is not changed
67

78
## Version 0.22.2
89

redux/autorun.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -270,6 +270,7 @@ def _call(
270270
**kwargs,
271271
)
272272
create_task = self._store._create_task # noqa: SLF001
273+
previous_value = self._latest_value
273274
if iscoroutine(value) and create_task:
274275
if self._options.auto_await:
275276
future = Future()
@@ -294,7 +295,8 @@ def _call(
294295
)
295296
else:
296297
self._latest_value = value
297-
self.inform_subscribers()
298+
if self._latest_value is not previous_value:
299+
self.inform_subscribers()
298300

299301
def __call__(
300302
self: Autorun[

0 commit comments

Comments
 (0)