From c2cddf7deb079f117ea8e170badee9a4ce7c9944 Mon Sep 17 00:00:00 2001 From: Rowan Self Date: Thu, 26 Oct 2023 12:38:21 +1300 Subject: [PATCH] fix throwing exception on app exit in certain menus --- dyno_viewer/app.py | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/dyno_viewer/app.py b/dyno_viewer/app.py index d1f0cd6..73069d1 100644 --- a/dyno_viewer/app.py +++ b/dyno_viewer/app.py @@ -213,10 +213,10 @@ async def on_query_screen_run_query(self, run_query: QueryScreen.RunQuery) -> No if run_query.filter_cond_exp: params["FilterExpression"] = run_query.filter_cond_exp - + if run_query.index != "table": params["IndexName"] = run_query.index - + self.dyn_query_params = params self.run_table_query(params) @@ -232,8 +232,13 @@ async def on_update_dyn_data_table(self, update_data: UpdateDynDataTable) -> Non # action methods async def action_exit(self) -> None: + if not self.query(DataDynTable): + # ensure we don't have any dirty data for next time app runs + table = self.query_one(DataDynTable) + table.clear() + else: + self.pop_screen() table = self.query_one(DataDynTable) - # ensure we don't have any dirty data for next time app runs table.clear() self.app.exit()