Thanks a lot Laurent for your response!
I could reply you before because I was struggling with a possible solution to 
solve the problem that I'm going to explain a little more:

when you try to coding a sequence of user interface states (i think it's named 
workflow steps) it would be great to have the possibility to move to a certain 
step (maybe the 5º, maybe the 20º ) and then be able to focus in certain steps 
transitions (http://clojurescriptone.com/) . 

If you save the data transition UI steps (as I think you are proposing ) as 
"app-state"  is almost like saving the pseudo-HTML rendered of each step. 

So far with my little knowledge of react/om and its tendency of thinking the UI 
compenents as machines 
https://groups.google.com/forum/#!searchin/clojurescript/OM/clojurescript/QuTjNgVl7do/1ipqt6QG12oJ
 , it doesn't seem to be possible to access the components downtree or uptree 
in other ways than shared-global-data  or passing parent-child props on init 
component phase (but the same component remain during many and different phases)

The solution that i've reached (still i don't know how good it is) consist on 
moving the app-state-step with an events sequence using core.async as 
synchronization event tool.
the use on development would be something like:

(def shared-channel (chan))
(defn inject [in model]
   (go (let [[out next] (<! in)]
        (>! out  model)
        (<! next))))

(def shared-channel-init (chan))
(def shared-channel-next (chan))

(do
    (>! shared-channel-init [ :welcome shared-channel-next]) ; use the channels 
of one OM component declared globally to have access to them 
    (-> shared-channel-init
      (inject {:flow-state :welcome)  ; state welcome
      (inject {:flow-state :connection) ; state  connection selected
      (inject {:connection-type :base) ;  state  basic subconnection selected
      (inject {:token-id "xxxxxxxx" :tenants mocks/tenants}) ; state tenant 
list (obtained after connected ok)
      (inject {:select-tenant "name" :endpoints mocks/eps}) ; state endpoints 
of tenant list once the user has selected a tenant
      ))


sooner I'll publish a gist with the OM component design details to achieve this 
behavior, but basically each component works with 3 channels:in-chan,own-chan 
and next-chan.
On init-state phase it recieves the in-chan and  creates its own-chan, and 
next-chan.
     om/IInitState
    (init-state [_]
      {:own-chan (chan)
       :next-chan (chan)})

On did-update phase we put inside the :in-chan (recieved chanel from parent 
component) a vector with 2 channels, the :own-chan ( the channel that 
represents the logic of the component) and the :next-chan (this channel used to 
connect other components)
(put! (om/get-state owner :in-chan) [(om/get-state owner :own-chan) 
(om/get-state owner :next-chan)])


I tried to be a bit more clear this time!
Juan



El lunes, 10 de febrero de 2014 17:14:27 UTC+1, Laurent PETIT  escribió:
> I don't know Om enough to be able to articulate a sound answer ... but I 
> can't resist trying anyway!
> 
> I tend to think there's often a false divide between, you know, "The App 
> State", the one that counts, the one that's server-side driven, and "the 
> rest, this ugly state we cannot get rid of and is part of the UI" ...
> 
> 
> 
> The UI is a real app, I mean, it's the first thing the user is exposed to, 
> and its state is also real important. Especially with browsers, when the user 
> is at risk of losing everything if they hit Back or close the window by 
> accident ...
> 
> 
> 
> ... meaning : can you refactor your app such that the component's state is 
> treated as durably as "The App State" ? Or maybe cut the apple in two, and 
> save it in local storage ?
> 
> Of course, maybe I don't even understood the question well .... :-)
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 
> 2014-02-10 16:15 GMT+01:00 JUAN ANTONIO Ruz <[email protected]>:
> 
> 
> Hello guys!
> 
> I'm wondering if there is a way to inject values through a BREPL to OM 
> components.
> 
> My idea would be pass values to certain components on an active workflow 
> flow, so i don't need to start always from a step one of my UI interaction 
> workflow.
> 
> 
> 
> Currently I was achieving this behavior through updating the "big" app-state 
> map, but it starts to get difficult when my components use their own state 
> ```(init-state [_] {:selection (chan)})```
> 
> 
> 
> The behavior i try to described  is the same than you can experiment when use 
>   http://clojurescriptone.com/
> 
> 
> 
> Thanks a lot!
> 
> 
> 
> NOTE: I'm using @cemerick/austin
> 
> 
> 
> --
> 
> 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