Skip to content

Commit d3118cc

Browse files
committed
temp
1 parent ad21a37 commit d3118cc

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

tests/test_core/test_hooks.py

+4
Original file line numberDiff line numberDiff line change
@@ -1379,3 +1379,7 @@ def InnerComponent():
13791379
hook.latest.schedule_render()
13801380
await layout.render()
13811381
assert inner_render_count.current == 1
1382+
1383+
1384+
async def test_use_state_named_tuple():
1385+
...

tests/tooling/hooks.py

+19
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,23 @@
1+
from contextlib import contextmanager
2+
from typing import Callable, Iterator
3+
14
from idom import use_state
5+
from idom.core.hooks import LifeCycleHook, current_hook
6+
7+
8+
class RenderCycle:
9+
def __init__(self):
10+
self.hook
11+
12+
13+
@contextmanager
14+
def active_hook(callback: Callable[[], None] = lambda: None) -> Iterator[None]:
15+
hook = LifeCycleHook(callback)
16+
hook.set_current()
17+
try:
18+
yield
19+
finally:
20+
hook.unset_current()
221

322

423
def use_toggle(init=False):

0 commit comments

Comments
 (0)