From c7caed096517be63f69570e9903c39ba6b7e6b73 Mon Sep 17 00:00:00 2001 From: mitaa Date: Mon, 7 Oct 2024 05:42:24 +0200 Subject: [PATCH] Fix race condition with DirectoryTrees --- src/production_planner/screens.py | 8 ++++---- tests | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/production_planner/screens.py b/src/production_planner/screens.py index 11d7f6a..68fc497 100644 --- a/src/production_planner/screens.py +++ b/src/production_planner/screens.py @@ -80,26 +80,26 @@ def highlighted_path(self) -> Path: current = self.first_dtree.cursor_node return None if current is None else current.data.path - def on_mount(self) -> None: + async def on_mount(self) -> None: # All these lines to simply move the cursor to the currently open file/folder datafile = core.APP.focused_table.sink.sink.target if not datafile: datafile = DataFile.get(Path(CONFIG.dpath_data) / "") self.first_dtree = self.FirstDTree(datafile.root) - self.mount(self.first_dtree, before=self.query_one(Footer)) + await self.mount(self.first_dtree, before=self.query_one(Footer)) if self.SecondDTree: # TODO: provide a way to change the root for this loading/saving action self.second_dtree = self.SecondDTree(datafile.root) - self.mount(self.second_dtree, after=self.first_dtree) + await self.mount(self.second_dtree, after=self.first_dtree) if self.entry: self.query_one(Input).value = os.path.splitext(str(datafile.subpath.name))[0] tree = self.first_dtree if self.expand_all: - tree.expand_all() + await tree.expand_all() def preselect(start=True): if start: diff --git a/tests b/tests index 80e570a..49023dc 160000 --- a/tests +++ b/tests @@ -1 +1 @@ -Subproject commit 80e570a540af6dae42998c2719eb7ba2d3302742 +Subproject commit 49023dc79785860924805d2c347cf74cb720717d