Skip to content

Commit 00b4e0e

Browse files
authored
Destroy .append_message_stream()'s error reporting effect only after it gets a chance to run (#1672)
1 parent 693b78f commit 00b4e0e

File tree

2 files changed

+3
-8
lines changed

2 files changed

+3
-8
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99

1010
### Bug fixes
1111

12+
* Fixed a bug with `Chat()` sometimes silently dropping errors. (#1672)
13+
1214
* `shiny create` now uses the template `id` rather than the directory name as the default directory. (#1666)
1315

1416
## [1.1.0] - 2024-09-03

shiny/ui/_chat.py

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -571,19 +571,12 @@ async def _stream_task():
571571

572572
# Since the task runs in the background (outside/beyond the current context,
573573
# if any), we need to manually raise any exceptions that occur
574-
try:
575-
ctx = reactive.get_current_context()
576-
except Exception:
577-
return
578-
579574
@reactive.effect
580575
async def _handle_error():
581576
e = _stream_task.error()
582577
if e:
583578
await self._raise_exception(e)
584-
585-
ctx.on_invalidate(_handle_error.destroy)
586-
self._effects.append(_handle_error)
579+
_handle_error.destroy() # type: ignore
587580

588581
async def _append_message_stream(self, message: AsyncIterable[Any]):
589582
id = _utils.private_random_id()

0 commit comments

Comments
 (0)