From 1859e64d834b63b9a5758d2401d57f2e317aedcc Mon Sep 17 00:00:00 2001 From: Tim Date: Sun, 9 Feb 2025 18:00:51 +0100 Subject: reset search query atom on re-opening app and switching screen --- ToDo.md | 3 +++ src/distractionless/core.cljd | 6 ++++-- 2 files changed, 7 insertions(+), 2 deletions(-) create mode 100644 ToDo.md diff --git a/ToDo.md b/ToDo.md new file mode 100644 index 0000000..44b647f --- /dev/null +++ b/ToDo.md @@ -0,0 +1,3 @@ +# ToDos + +- [ ] Reset search bar state/input too when resetting search query atom on re-opening app and switching screen diff --git a/src/distractionless/core.cljd b/src/distractionless/core.cljd index 2036da6..e3a39b9 100644 --- a/src/distractionless/core.cljd +++ b/src/distractionless/core.cljd @@ -24,13 +24,15 @@ config-file (io/File. (str (.-path data-dir) "/config.edn")) _ (dconfig/init-config! config-file nil) ; Init config on app startup _ (m/AppLifecycleListener .onShow #(do (dconfig/init-config! config-file nil) - (duapps/load-installed-apps! *apps))) + (duapps/load-installed-apps! *apps) + (reset! *query ""))) page-controller (m/PageController.)] :let [root-container-padding (m/EdgeInsets.only .top 50)] (m/PageView. .controller page-controller - .children [(let [favourites (get (dconfig/read-from-file config-file) "favourites")] + .onPageChanged (fn [_] (reset! *query "")) + .children [(let [favourites (get (dconfig/read-from-file config-file) "favourites")] (m/Container .padding root-container-padding .child (m/Column -- cgit v1.2.3