untangled 2017-01-04

@eveline has joined the channel

server side rendering is on the develop branch now.

I'll try to get some time to test the current develop branch against various projects and cut a release in the next couple of days

2

for the time being, 0.6.2-SNAPSHOT has ssr, but we're technically still on 0.6.1-SNAPSHOT sans ssr

@njj has joined the channel

hi all, we have an untangled app that follows the similar pattern provided in the tutorial videos for “tab routing”, app/choose-tab etc. The issue I am having with this pattern is that I can’t seem to get hash routing to work w/ it correctly. Is there any documentation on this or examples?

If I attach a onClick handler, and not a hash route to my links, things work great. But once I try to move that method into the route method and use a basic hash href I hit a wall.

Tons of documentation and examples. The untangled-cookbook has a working example. The most common errors: - Putting the ident in the "wrong order". [:type-of-thing ID] is correct, but many people want to do [ID :tab] when working with tabs...this won't work, because the first ele of the ident is used to pick the query from the UI component

- Not structuring the query properly

oh wait...hash routing: you mean HTML 5 URL-based routing?

right, I want to be able to use something like secretary and have my tab links be handled in the defroute calls rather than onClick in the link - if that makes sense?

you just want to do a transact! against the reconciler on the routing event, which is in the app at the :reconciler key.

i.e. /#/users, etc..

(transact! (:reconciler @app) `[(app/choose-tab { :tab ~t })])

(defroute listings-activated "/listings/activated" []
  (transact! @reconciler [(app/choose-tab {:tab :search :es-type "listing"})
                          (search/new-query {:listing-status "ACTIVATED"
                                             :time-field :date_created
                                             :es-sort-fields [:date_created]})
                          :ui/root]))
is an example of what I’m trying to do

where t is whatever you need to pass

this transact was previously in the onClick event handler on the actual a tag before

that looks roughly right. Sure your mutation is already working (e.g. if you hook up a button it works)

also, where is your quoting?

or did you just elide that in your copy/paste

Not sure I follow 🙂

your transaction isn't quoted, meaning you'd actually ask the runtime to run a function called app/choose-tab

instead of passing it as data to transact

looks like a single-quote would suffice, since you are not needing unquote

previous to the vector of mutations?

Oh I see.. my transact! was actually re-written by the person who setup this project, so it doesn’t need a quote apparently 🙂 @tony.kay

um....there is no way that is right, unless you've built a defroute macro that reinterprets it

(transact! r [(f)]) will try to call f, put the result of f into the vector, then call transact....which will fail miserably

unless f returns a list that looks like a function call

(transact! r '[(f)]) will pass the data structure [(f)] to transact, which will be parsed and have mutations processed

(f) is meant to look like a function, but it is used as a data structure, not as an invocation.

The fact that the parser ends up invoking code makes this a little confusing. The data structure (f) does end up calling something

just not a top-level clj(s) function

sova-soars-the-sora 2017-01-04T22:39:10.001694Z

i love clojure and cljs.

sova-soars-the-sora 2017-01-04T22:39:18.001695Z

just had to express that.

sova-soars-the-sora 2017-01-04T23:23:09.001700Z

So I want to accomplish some serverside rendering... I have a core.cljs that renders a nice UI using om.next... I now want to pre-render this UI on the server side in server.clj ... I thought I would make a ui.cljc file and then include it in both the client and the serverside, but there are some quirks between cljs/clj/cljc that I am not well versed in yet... trying to :require om.next :as om just shows me a lot of unknowns. like it doesn't understand the #js tag (of course) ... I suppose I'll have a closer look at foam + cellophane