Skip to content

Commit 43970ae

Browse files
committed
better fix
1 parent b16c7bc commit 43970ae

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

src/textual/app.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1419,7 +1419,7 @@ def _validate_theme(self, theme_name: str) -> str:
14191419
raise InvalidThemeError(message)
14201420
return theme_name
14211421

1422-
async def _watch_theme(self, theme_name: str) -> None:
1422+
def _watch_theme(self, theme_name: str) -> None:
14231423
"""Apply a theme to the application.
14241424
14251425
This method is called when the theme reactive attribute is set.
@@ -3657,8 +3657,9 @@ def refresh_css(self, animate: bool = True) -> None:
36573657
stylesheet.reparse()
36583658
stylesheet.update(self.app, animate=animate)
36593659
try:
3660-
self.screen._refresh_layout(self.size)
3661-
self.screen._css_update_count = self._css_update_count
3660+
if self.screen.is_mounted:
3661+
self.screen._refresh_layout(self.size)
3662+
self.screen._css_update_count = self._css_update_count
36623663
except ScreenError:
36633664
pass
36643665
# The other screens in the stack will need to know about some style

0 commit comments

Comments
 (0)