Accessing a cursor only creates a cursor if the resulting value is a vector
or map. :customer is a string, so accessing it will return a string and not
a cursor.

If you want to be able to trasnact! or update! :customer, you will need to
wrap it in a vector or map.

https://github.com/swannodette/om/wiki/Cursors#creating-sub-cursors


On 4 May 2014 15:33, Roger Gilliar <[email protected]> wrote:

> My component looks like this:
>
> (defn- domain-data [_ owner]
>   (reify
>
>     om/IInitState
>     (init-state [_]
>       {:domain nil})
>
>     om/IWillMount
>     (will-mount [state]
>       (th/poll @chan (fn[data] (om/set-state! owner :domain data)))) ;;
> sets the state with a selected domain
>
>     om/IRenderState
>     (render-state [this state]
>      (if-let [domain (:domain state)]
>         (dom/div nil
>                  (om/build header/header-comp domain)
>                  (om/build (customer-info/create update-chan) (get-in
> state [:domain :customer-info])))
>         (dom/span nil "")))))
>
> It seems that (get-in state [:domain :customer-info]) doesn't create a
> cursor. Because some lines down the source I get
>
> No protocol method ITransact.-transact! defined for type
> cljs.core/PersistentArrayMap
>
> as soon as I try to call
>
> (om/transact! app-state assoc key value);  app-state is the result of the
> get-in call
>
> BTW:
>
> The customer-info/app-state may look like this:
> {:customer-nr "12332233", :customer "a company", :ip "122.122.1.23",
> :description "database server"}
>
>
>
>
> --
> Note that posts from new members are moderated - please be patient with
> your first post.
> ---
> You received this message because you are subscribed to the Google Groups
> "ClojureScript" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to [email protected].
> To post to this group, send email to [email protected].
> Visit this group at http://groups.google.com/group/clojurescript.
>

-- 
Note that posts from new members are moderated - please be patient with your 
first post.
--- 
You received this message because you are subscribed to the Google Groups 
"ClojureScript" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/clojurescript.

Reply via email to