Skip to content

Commit

Permalink
clear typeahead items on model change
Browse files Browse the repository at this point in the history
  • Loading branch information
dgknght committed Dec 22, 2023
1 parent b6f38b2 commit 7126da7
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
2 changes: 1 addition & 1 deletion project.clj
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
(defproject com.github.dgknght/app-lib "0.3.7"
(defproject com.github.dgknght/app-lib "0.3.8"
:description "Library of commonly used functions for web app development"
:url "https://github.com/dgknght/app-lib"
:license {:name "EPL-2.0 OR GPL-2.0-or-later WITH Classpath-exception-2.0"
Expand Down
3 changes: 2 additions & 1 deletion src/cljs/dgknght/app_lib/forms/typeahead.cljs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
(reset! text-value (get-in after field)))

(defn watch-model
[{:keys [model field] :as options}]
[{:keys [model field items] :as options}]
(add-watch model
(cons ::typeahead field)
(fn [_ _ before after]
Expand All @@ -45,6 +45,7 @@
; not now need to be rerendered?
(when (not= (get-in before field)
(get-in after field))
(reset! items nil)
(handle-model-change before after options)))))

(defn set-value
Expand Down

0 comments on commit 7126da7

Please sign in to comment.