untangled

NEW CHANNEL: #fulcro
tony.kay 2017-01-04T16:40:17.001658Z

server side rendering is on the develop branch now.

tony.kay 2017-01-04T16:40:46.001659Z

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
tony.kay 2017-01-04T16:41:22.001660Z

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

exit2 2017-01-04T21:59:51.001662Z

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?

exit2 2017-01-04T22:00:57.001663Z

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.kay 2017-01-04T22:01:20.001664Z

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.kay 2017-01-04T22:01:33.001665Z

- Not structuring the query properly

tony.kay 2017-01-04T22:01:59.001666Z

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

exit2 2017-01-04T22:02:33.001667Z

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.kay 2017-01-04T22:02:36.001668Z

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

exit2 2017-01-04T22:02:44.001669Z

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

tony.kay 2017-01-04T22:03:10.001670Z

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

exit2 2017-01-04T22:03:35.001673Z

(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.kay 2017-01-04T22:03:37.001674Z

where t is whatever you need to pass

exit2 2017-01-04T22:04:10.001675Z

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

tony.kay 2017-01-04T22:04:16.001676Z

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

tony.kay 2017-01-04T22:04:34.001677Z

also, where is your quoting?

tony.kay 2017-01-04T22:04:46.001678Z

or did you just elide that in your copy/paste

exit2 2017-01-04T22:05:00.001679Z

Not sure I follow 🙂

tony.kay 2017-01-04T22:05:26.001680Z

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

tony.kay 2017-01-04T22:05:32.001681Z

instead of passing it as data to transact

tony.kay 2017-01-04T22:06:03.001682Z

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

exit2 2017-01-04T22:06:31.001684Z

previous to the vector of mutations?

exit2 2017-01-04T22:12:12.001685Z

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.kay 2017-01-04T22:12:42.001686Z

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

tony.kay 2017-01-04T22:13:38.001688Z

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

tony.kay 2017-01-04T22:13:48.001689Z

unless f returns a list that looks like a function call

tony.kay 2017-01-04T22:14:29.001690Z

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

tony.kay 2017-01-04T22:15:00.001691Z

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

tony.kay 2017-01-04T22:15:28.001692Z

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

tony.kay 2017-01-04T22:15:36.001693Z

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