fix: Datepicker behaves oddly if there are 2 datepickers visible at the same time (#7498)

fixes #7341

Co-authored-by: Gabriel Horner <97210743+logseq-cldwalker@users.noreply.github.com>
This commit is contained in:
sallto
2022-12-14 23:41:08 +01:00
committed by GitHub
parent 04b6bcf582
commit e96c3403bf
3 changed files with 40 additions and 26 deletions

View File

@@ -83,7 +83,6 @@
(reset! *timestamp default-timestamp-value)
(reset! *show-time? false)
(reset! *show-repeater? false)
(state/set-timestamp-block! nil)
(state/set-state! :date-picker/date nil))
(defn- on-submit
@@ -131,16 +130,14 @@
(rum/defc date-picker < rum/reactive
{:init (fn [state]
(let [ts (last (:rum/args state))]
(clear-timestamp!)
(if ts
(reset! *timestamp ts)
(reset! *timestamp {:time ""
:repeater {}}))
(when-not (:date-picker/date @state/state)
(state/set-state! :date-picker/date (get ts :date (t/today)))))
state)
:will-unmount (fn [state]
(clear-timestamp!)
state)}
state)}
[id format _ts]
(let [current-command @commands/*current-command
deadline-or-schedule? (and current-command