Skip to content

Commit 02a2ab7

Browse files
committed
Add coverage test
1 parent 8640a69 commit 02a2ab7

File tree

2 files changed

+18
-1
lines changed

2 files changed

+18
-1
lines changed

CHANGELOG.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -104,7 +104,7 @@ Don't forget to remove deprecated code on each major release!
104104
- Fixed a bug where script elements would not render to the DOM as plain text.
105105
- Fixed a bug where the `key` property provided within server-side ReactPy code was failing to propagate to the front-end JavaScript components.
106106
- Fixed a bug where `RuntimeError("Hook stack is in an invalid state")` errors could be generated when using a webserver that reuses threads.
107-
- Fixed a bug where events (server to client, and client to server) could be lost during rapid actions.
107+
- Fixed a bug where events on controlled inputs (e.g. `html.input({"onChange": ...})`) could be lost during rapid actions.
108108
- Allow for ReactPy and ReactJS components to be arbitrarily inserted onto the page with any possible hierarchy.
109109

110110
## [1.1.0] - 2024-11-24

tests/test_core/test_layout.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,23 @@ async def test_thread_safe_queue_applies_backpressure():
122122
await queue.close()
123123

124124

125+
async def test_thread_safe_queue_close_cancels_pending_puts():
126+
with patch.object(REACTPY_MAX_QUEUE_SIZE, "current", 1):
127+
queue = _ThreadSafeQueue[int]()
128+
129+
await queue._queue.put(1)
130+
queue._pending.add(2)
131+
task = asyncio.create_task(queue._put_with_backpressure(2))
132+
queue._put_tasks[2] = task
133+
134+
await asyncio.sleep(0)
135+
await queue.close()
136+
137+
assert task.cancelled()
138+
assert queue._put_tasks == {}
139+
assert queue._pending == set()
140+
141+
125142
async def test_nested_component_layout():
126143
parent_set_state = reactpy.Ref(None)
127144
child_set_state = reactpy.Ref(None)

0 commit comments

Comments
 (0)