Skip to content

Commit 87622ad

Browse files
committed
set active message pump on action
1 parent e9ad400 commit 87622ad

File tree

2 files changed

+5
-1
lines changed

2 files changed

+5
-1
lines changed

src/textual/app.py

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3138,7 +3138,7 @@ async def run_action(
31383138
return False
31393139

31403140
async def _dispatch_action(
3141-
self, namespace: object, action_name: str, params: Any
3141+
self, namespace: DOMNode, action_name: str, params: Any
31423142
) -> bool:
31433143
"""Dispatch an action to an action method.
31443144
@@ -3159,6 +3159,7 @@ async def _dispatch_action(
31593159
params=params,
31603160
)
31613161

3162+
reset_active_message_pump = active_message_pump.set(namespace)
31623163
try:
31633164
private_method = getattr(namespace, f"_action_{action_name}", None)
31643165
if callable(private_method):
@@ -3175,6 +3176,8 @@ async def _dispatch_action(
31753176
except SkipAction:
31763177
# The action method raised this to explicitly not handle the action
31773178
log.system(f"<action> {action_name!r} skipped.")
3179+
finally:
3180+
active_message_pump.reset(reset_active_message_pump)
31783181
return False
31793182

31803183
async def _broker_event(

src/textual/screen.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,7 @@
6969
"""Type of a screen result callback function."""
7070

7171

72+
@rich.repr.auto
7273
class ResultCallback(Generic[ScreenResultType]):
7374
"""Holds the details of a callback."""
7475

0 commit comments

Comments
 (0)