Skip to content

Commit

Permalink
discussion with Peter Geoffrey Dustin
Browse files Browse the repository at this point in the history
  • Loading branch information
dustingetz committed Apr 23, 2024
1 parent 95e507a commit 7e51214
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 4 deletions.
5 changes: 3 additions & 2 deletions src-docs/wip/demo_todos_optimistic.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,14 @@
(dom/div (dom/style {:display "flex", :align-items "center"})
(amb
(ui5/Field.
:record (get ?record :task/status) ; todo entity api
:record {:task/status (get ?record :task/status)} ; todo entity api
:Control ui5/Checkbox
:parse {:done true, :active false}
:unparse {true :done, false :active}
:edit (fn [v] [{:db/id (:db/id ?record) :task/status v}
[{:db/id (:db/id ?record) :task/status v}]]))
(ui5/Field.
:record (get ?record :task/description)
:record {:task/description (get ?record :task/description)}
:Control ui5/Input
:edit (fn [v] [{:task/description v}
[{:db/id (:db/id ?record) :task/description v}]]))))))
Expand Down Expand Up @@ -102,6 +102,7 @@ on submit"
(FailRate. 3 10))

(let [edits (Page.)] ; accidental transfer
; careful, rules of pending need to be stable to not repeat txns. e.g. x -> pending -> x can repeat
(e/server
(new (m/ap
(let [tx-report (m/?< ui5/>tx-report)]
Expand Down
2 changes: 1 addition & 1 deletion src/hyperfiddle/electric_ui5.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -135,7 +135,7 @@ through its edit lifecycle (dirty -> pending -> completed)."
(let [[pending-view-diffs x! dx!] (CreateController. stable-kf CreateForm)]
; todo xdx can be a form monitor, not just single field
; emit isolated txs that race unless a popover batches them
(->> (e/server (e/expand-by stable-kf records)) ; legal transfer!
(->> (e/server (e/diff-by stable-kf records)) ; legal transfer!
(mx/mix-diffs >pending-view-diffs) ; TODO: local info must take precedence
(e/par EditForm) ; list of fields
maintain-vec ; list of forms is a list-list-fields
Expand Down
2 changes: 1 addition & 1 deletion src/hyperfiddle/stage.cljc
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
(m/ap
(let [edits (->> (m/?< <edit-monitor) ; sparse
(remove nil?)) ; most fields are not firing concurrently
[x tx] (m/?> ##Inf (m/seed edits))] ; serialize them?
[x tx] (m/?> ##Inf (apply m/seed edits))] ; serialize them?
(m/amb
#_(assoc old-tx-report ::pending tx) ; for what purpose? & do on client?
(try
Expand Down

0 comments on commit 7e51214

Please sign in to comment.