untangled

NEW CHANNEL: #fulcro
claudiu 2017-05-25T08:36:32.313084Z

@tony.kay regarding om-css with advanced optimisations.

claudiu 2017-05-25T08:36:41.314754Z

In development mode and simple optimisations when i do (pr-str Component) I get a string namespace/Component but with advanced optimisations I get #object[$U "function (){React.Component.apply(this,arguments);this.state=null!=<http://this.cc?this.cc():{};return|this.cc?this.cc():{};return> this}"].

claudiu 2017-05-25T09:00:06.592151Z

ohh small gotcha. I had :pretty-print false so it removed pr-str.

tony.kay 2017-05-25T17:46:34.354801Z

@claudiu so it works now?

claudiu 2017-05-25T19:29:39.532922Z

@tony.kay Spoke to soon. most of mixed up the builds and thought it worked.

claudiu 2017-05-25T19:30:23.547477Z

As a simple test #?(:cljs (js/console.log (prn-str Root) (pr-str Root))) seems to work on dev, simple but not for advanced compilation

tony.kay 2017-05-25T19:46:52.871163Z

I’m not sure why we’re talking about pr-str

tony.kay 2017-05-25T19:47:47.889466Z

I thought you had some question about the css support working with advanced

tony.kay 2017-05-25T19:48:47.909794Z

ah, from an earlier message. I see. You’re saying that the generated CSS classnames are getting messed with during advanced compilation

tony.kay 2017-05-25T19:49:50.930987Z

That is probably a bug with om-css. There is probably some other method of getting the component name that doesn’t work the same when adv compilation is used.

tony.kay 2017-05-25T20:04:56.250063Z

In advanced compilation the artifacts are going to be renamed and minified. But I would not expect this to break anything.

claudiu 2017-05-25T20:14:46.449229Z

yep strange one. Tried it on a clean chestnut template:

claudiu 2017-05-25T20:15:17.460050Z

(defui Component
  Object
  (render [this]
    (dom/div nil "test")))
(js/console.log (prn-str Component) "" (pr-str Component))

claudiu 2017-05-25T20:15:43.469089Z

behaves exactly the same 😞

claudiu 2017-05-25T20:18:09.517419Z

on clojurescript slack someone suggested that it might be related to this issue: https://dev.clojure.org/jira/browse/CLJS-1249

tony.kay 2017-05-25T20:19:19.540739Z

not sure

tony.kay 2017-05-25T20:19:48.550255Z

the function in question is https://github.com/untangled-web/om-css/blob/master/src/om_css/core.cljc#L22

tony.kay 2017-05-25T20:20:02.554973Z

we just need to figure out what the “right way” is to get that string…it is prob not pr-str

claudiu 2017-05-25T20:22:58.613465Z

yes 🙂 untangled/om-css is exactly what I was looking for, and the new pull request seems really nice.

tony.kay 2017-05-25T20:23:11.617604Z

yeah, I’m excited about the improvements

tony.kay 2017-05-25T20:23:26.622888Z

eliminates duplication and simplifies usage

2017-05-25T20:48:18.124648Z

Does anyone know of a good tutorial on creating “switcher” components via union queries that isn’t based on Untangled?

tony.kay 2017-05-25T20:48:43.132867Z

The Untangled in the Large videos on YouTube walk you though how it is built

tony.kay 2017-05-25T20:48:49.135074Z

the HTML5 routing video

tony.kay 2017-05-25T20:48:57.137448Z

identical to Om Next

tony.kay 2017-05-25T20:49:08.140946Z

other than you have to write the parser that handles the data reads

2017-05-25T20:49:20.144942Z

The bit that’s tripping me up is figuring out which parts of the behavior are coming from the untangled-specific initial state stuff

tony.kay 2017-05-25T20:49:33.149216Z

@claudiu So, it looks like if we use the React displayName that will survive advanced compile…I’m trying it now

2017-05-25T20:49:47.153557Z

Ah, so it’s not expected that the default db->tree would be able to resolve something like this?

tony.kay 2017-05-25T20:49:48.154072Z

initial state works for Om Next

tony.kay 2017-05-25T20:50:01.158410Z

Untangled’s parser IS db-&gt;tree

tony.kay 2017-05-25T20:50:15.163177Z

and InitialAppState composes a tree to Root that IS what you’d pass to Om Next

tony.kay 2017-05-25T20:50:32.168973Z

I would not dream of using Om Next without InitialAppState

2017-05-25T20:50:39.171223Z

Right

tony.kay 2017-05-25T20:50:42.172269Z

eliminates so many headaches with about 10 lines of code

tony.kay 2017-05-25T20:51:09.181299Z

it really is just a protocol

tony.kay 2017-05-25T20:51:17.184177Z

and a getter to support SSR

2017-05-25T20:51:33.189376Z

Yeah. I’m inheriting some non-untangled code and figuring out what’s salvageable

2017-05-25T20:52:05.200057Z

And trying to figure out why we didn’t just use untangled 😛

tony.kay 2017-05-25T20:52:08.200849Z

oh…I lied

tony.kay 2017-05-25T20:52:20.205059Z

InitialAppState for unions has a helper function to add in union initialization

tony.kay 2017-05-25T20:52:26.206838Z

which is what you’re tripping over

tony.kay 2017-05-25T20:52:34.209635Z

that function would work with stock Om Next too

2017-05-25T20:52:50.215336Z

Will take a look. Thanks!

tony.kay 2017-05-25T20:52:56.217456Z

I’m biased, but not sure why more ppl aren’t using untangled 😜

tony.kay 2017-05-25T20:53:07.221045Z

guess I’m not advertising enough

wilkerlucio 2017-05-25T20:56:27.289067Z

tony.kay: my guess would be that people take some time to realize that Om.next by itself is very bare bones, adding Untangled creates more layers than people are used to, maybe we should make a survey, hehe

tony.kay 2017-05-25T20:57:34.312072Z

Yeah, I’m thinking the pitch should be something that helps people understand that. I think people see Untangled as something completely different, as opposed to something that makes Om Next easier

2017-05-25T20:57:58.319895Z

@tony.kay was merge-alternate-union-elements! the helper in question?

tony.kay 2017-05-25T20:58:03.321914Z

yep

👍 1
tony.kay 2017-05-25T20:58:26.329602Z

it walks the query and uses declared INitialAppState for find the “extras”

tony.kay 2017-05-25T21:09:23.543060Z

@claudiu Try om-css version 1.0.2-SNAPSHOT

tony.kay 2017-05-25T21:11:40.584694Z

I don’t remember why, but there are CSS tests for augmenting via a defrecord…not sure those will work right in advanced…but not sure why they even exist

tony.kay 2017-05-25T21:12:08.592435Z

I think I was thinking you might want to make namespaced CSS without defui (use defrecord instead)

tony.kay 2017-05-25T21:12:28.598820Z

I’m going to play with that and see if it still works, but the new version should fix your problem

tony.kay 2017-05-25T21:14:36.636515Z

Yeah, I don’t think I can make that one work. So, defrecord support will not work in advanced compilation…use defui instead (you don’t need a render method on a defui). I doubt anyone is doing that, but it is an easy fix.

tony.kay 2017-05-25T21:23:12.787838Z

Om-css version 1.0.2 pushed. Fixes advanced compilation