Fork me on GitHub
#untangled
<
2017-01-04
>
tony.kay16:01:17

server side rendering is on the develop branch now.

tony.kay16:01:46

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

tony.kay16:01:22

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

exit221:01:51

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?

exit222:01:57

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.

tony.kay22:01:20

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

tony.kay22:01:33

- Not structuring the query properly

tony.kay22:01:59

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

exit222:01:33

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?

tony.kay22:01:36

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

exit222:01:44

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

tony.kay22:01:10

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

exit222:01:35

(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

tony.kay22:01:37

where t is whatever you need to pass

exit222:01:10

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

tony.kay22:01:16

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

tony.kay22:01:34

also, where is your quoting?

tony.kay22:01:46

or did you just elide that in your copy/paste

exit222:01:00

Not sure I follow 🙂

tony.kay22:01:26

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

tony.kay22:01:32

instead of passing it as data to transact

tony.kay22:01:03

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

exit222:01:31

previous to the vector of mutations?

exit222:01:12

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

tony.kay22:01:42

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

tony.kay22:01:38

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

tony.kay22:01:48

unless f returns a list that looks like a function call

tony.kay22:01:29

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

tony.kay22:01:00

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

tony.kay22:01:28

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

tony.kay22:01:36

just not a top-level clj(s) function

SoV422:01:10

i love clojure and cljs.

SoV422:01:18

just had to express that.

SoV423:01:09

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