-
-
Save danielstockton/f52f87ac604d3523f10100b964b8b957 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns compassus-bug.core | |
(:require [compassus.core :as compassus] | |
[goog.dom :as gdom] | |
[om.next :as om :refer-macros [defui]] | |
[om.dom :as dom])) | |
(enable-console-print!) | |
(defmulti read om/dispatch) | |
(defmethod read :foo | |
[{:keys [ast]} _ _] | |
(let [ast' (assoc-in ast [:params :foo] :bar)] | |
{:remote ast'})) | |
(defui Child | |
Object | |
(render [this] | |
(dom/a | |
#js {:href "#" | |
:onClick (fn [e] (om/transact! this [:foo]))} | |
"Trigger transact!"))) | |
(def child (om/factory Child)) | |
(defui Index | |
static om/IQuery | |
(query [this] | |
[:foo]) | |
Object | |
(render [this] | |
(dom/div nil | |
(child)))) | |
(defn send [remotes cb] | |
(println (:remote remotes))) | |
(def reconciler | |
(om/reconciler | |
{:state {} | |
:parser (compassus/parser {:read read}) | |
:send send})) | |
(om/add-root! reconciler | |
(om/factory Index) (gdom/getElement "app")) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment