Skip to content

Commit

Permalink
Fix overloads
Browse files Browse the repository at this point in the history
  • Loading branch information
Archmonger committed Feb 3, 2025
1 parent 6033d27 commit 13fae72
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions src/reactpy/core/hooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -173,13 +173,15 @@ async def effect(stop: asyncio.Event) -> None:
def use_async_effect(
function: None = None,
dependencies: Sequence[Any] | ellipsis | None = ...,
shutdown_timeout: float = 0.1,
) -> Callable[[_EffectApplyFunc], None]: ...


@overload
def use_async_effect(
function: _AsyncEffectFunc,
dependencies: Sequence[Any] | ellipsis | None = ...,
shutdown_timeout: float = 0.1,
) -> None: ...


Expand Down Expand Up @@ -227,8 +229,8 @@ async def effect(stop: asyncio.Event) -> None:
# Wait until we get the signal to stop this effect
await stop.wait()

# If renders are queued back-to-back, then this effect function might have
# not completed. So, we give the task a small amount of time to finish.
# If renders are queued back-to-back, the effect might not have
# completed. So, we give the task a small amount of time to finish.
# If it manages to finish, we can obtain a clean-up function.
results, _ = await asyncio.wait([task], timeout=shutdown_timeout)
if results:
Expand Down

0 comments on commit 13fae72

Please sign in to comment.