-
-
Notifications
You must be signed in to change notification settings - Fork 328
use_async_effect cleanup not executed in 2.0.0b7 #1326
-
Hello,
First of all, thank you for this project. I’ve been using ReactPy 2.0 in a couple of small pet projects, and it’s been really nice to work with so far.
As I mentioned in the title, the cleanup function is not executed when the dependency of the use_async_effect changes. The issue can be reproduced by transforming the test_memoized_effect_cleanup_only_triggered_before_new_effect to use an async effect:
diff --git a/tests/test_core/test_hooks.py b/tests/test_core/test_hooks.py index 93e64a69..434d7ad3 100644 --- a/tests/test_core/test_hooks.py +++ b/tests/test_core/test_hooks.py @@ -451,8 +451,8 @@ async def test_memoized_effect_cleanup_only_triggered_before_new_effect(): def ComponentWithEffect(): state, set_state_callback.current = reactpy.hooks.use_state(first_value) - @reactpy.hooks.use_effect(dependencies=[state]) - def effect(): + @reactpy.hooks.use_async_effect(dependencies=[state]) + async def effect(): def cleanup(): cleanup_trigger_count.current += 1
Thank you in advance
Beta Was this translation helpful? Give feedback.
All reactions
Fixed in #1328
Replies: 1 comment 2 replies
-
Thank you for the bug report. I will investigate this ASAP.
Beta Was this translation helpful? Give feedback.
All reactions
-
❤️ 1
-
Fixed in #1328
Beta Was this translation helpful? Give feedback.
All reactions
-
Thank for the fast fix!
Beta Was this translation helpful? Give feedback.