Skip to content

Instantly share code, notes, and snippets.

@eyston

eyston/om.cljs Secret

Created February 8, 2016 07:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save eyston/7f870671e00067020b00 to your computer and use it in GitHub Desktop.
Save eyston/7f870671e00067020b00 to your computer and use it in GitHub Desktop.
;; starting app state
{:current-user [:person/by-id 1],
:todo/by-id
{1
{:id 1,
:text "Taste ClojureScript",
:completed? false,
:author {:id 1}},
2
{:id 2, :text "Buy a unicorn", :completed? false, :author {:id 1}}},
:person/by-id
{1
{:id 1,
:name "Huey",
:todosCount 2,
:todos [[:todo/by-id 1] [:todo/by-id 2]]}},
:om.next/tables #{:todo/by-id :person/by-id}}
; transact! [`(todo/toggle {:id ~id}) :completed?]
; [ 7.676s] [om.next] [:todo/by-id 1] transacted '[(todo/toggle {:id 1}) {:current-user [{:todos [:completed?]}]} {:current-user [{:todos [:completed?]}]}], #uuid "048f5871-f650-4fc2-986e-7b27b9f8cb76"
; remote [(todo/toggle {:id 1}) {:current-user [{:todos [:completed?]}]} {:current-user [{:todos [:completed?]}]}]
; remote payload : {todo/toggle {}, :current-user {:todos [{:completed? true} {:completed? false}]}}
; end app state
{:current-user {:todos [{:completed? true} {:completed? false}]},
:todo/by-id
{1
{:id 1,
:text "Taste ClojureScript",
:completed? false,
:author {:id 1}},
2
{:id 2, :text "Buy a unicorn", :completed? false, :author {:id 1}}},
:person/by-id
{1
{:id 1,
:name "Huey",
:todosCount 2,
:todos [[:todo/by-id 1] [:todo/by-id 2]]}},
:om.next/tables #{},
todo/toggle {}}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment