Skip to content

Commit

Permalink
InpuSubmit! - document issues
Browse files Browse the repository at this point in the history
  • Loading branch information
dustingetz committed Sep 23, 2024
1 parent 2baac1d commit 4267e46
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions src/hyperfiddle/input_zoo0.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
(dom/button (dom/text label) ; (if err "retry" label)
(dom/props (-> props (dissoc :label :disabled) (assoc :id id)))
(let [[t err] (e/RetryToken (dom/On "click" identity nil))]
(prn 'Button! t (some? err))
(prn 'Button! directive t err)
(dom/props {:disabled (or disabled (some? t))}) ; todo compile kw args
(when (some? err) (dom/props {:aria-invalid true})) ; bug - error not removed (glitch)
(if t [t directive] (e/amb))))) ; injected tokens do not resubmit until user interacts again
Expand Down Expand Up @@ -119,9 +119,10 @@
waiting? (or (some? t) (some? token))
error? (some? err) ; todo route error from original token
dirty? (or editing? waiting-mine? error?)]
(prn 'InputSubmit! editing? waiting-mine? waiting? error? dirty?) ; prove glitch
(when-not dirty? (set! (.-value dom/node) v))
(when error? (dom/props {:aria-invalid true}))
(when waiting? (dom/props {:aria-busy true}))
(when waiting? (dom/props {:aria-busy true})) ; glitch
(if waiting?
[(or t token) ; absorb foreign token
((fn [] (cond
Expand All @@ -132,6 +133,7 @@
; [t v e] - t can be burned but e & v remains = retry ?

external-submit? (some? token) ; inlining this under when causes a glitch NPE in commit
; q (and external-submit? (not= t token))
dirty? (e/Some? t)
locally-dirty? (and (e/Some? t) (not= t token)) ; cancel inflight txn in this case - todo
can-commit? locally-dirty?
Expand All @@ -141,7 +143,6 @@
(Button! ::commit :label "commit" :disabled (not can-commit?)) ; todo progress
(Button! ::discard :label "discard" :disabled (not dirty?)))]

#_(prn 'InputSubmit! 'external-submit? external-submit?)
external-submit? ; workaround crash on discard in todos

;(prn 'edit (e/Some? t) (e/as-vec v)) (prn 'btns (e/as-vec btns))
Expand Down

0 comments on commit 4267e46

Please sign in to comment.