untangled

NEW CHANNEL: #fulcro
tony.kay 2017-01-05T00:47:43.001701Z

no cellophane....just Om Next v alpha45+

tony.kay 2017-01-05T00:47:48.001702Z

@sova

tony.kay 2017-01-05T00:48:07.001703Z

and untangled client v 0.6.2-SNAPSHOT

tony.kay 2017-01-05T00:48:17.001704Z

then yes, a cljc file.

tony.kay 2017-01-05T00:49:21.001705Z

The #js thing requires data-readers, which is in Om next. I've seen it have problems with that...might ask on the Om channel. Really all you need is a data_readers.clj file that has the line {js clojure.core/identity} I think

tony.kay 2017-01-05T00:49:49.001706Z

anything with a # in front of it is an EDN tag meant to trigger a reader. Setting the js reader to identity on clj will do it

tony.kay 2017-01-05T00:50:09.001707Z

but Om should have already done that...might try a clean and restart of everything, and make sure latest version of Om/cljs

tony.kay 2017-01-05T00:51:00.001708Z

At one point I just changed #js to (clj->js { ... }) and put a #?(:clj (def clj->js identity)) at the top of the file

tony.kay 2017-01-05T00:51:20.001710Z

but again, you can do that via data readers

sova-soars-the-sora 2017-01-05T02:19:27.001711Z

Okay, Thanks a lot @tony.kay I am wondering... how can I know the latest versions available for cljs and also om.next?

adambros 2017-01-05T02:20:01.001712Z

@sova I use this https://github.com/xsc/lein-ancient

sova-soars-the-sora 2017-01-05T02:22:10.001714Z

@adambros Why thank you sir, that is excellent.

๐Ÿ˜ 1
sova-soars-the-sora 2017-01-05T02:41:27.001715Z

(dom/render-to-str) does not appear to exist in om alpha 45, but 46 is good. just fyi

sova-soars-the-sora 2017-01-05T02:41:49.001716Z

or maybe I spoke too soon.. hrm.

sova-soars-the-sora 2017-01-05T02:43:30.001717Z

`#object[ReferenceError ReferenceError: ReactDOMServer is not defined] ReferenceError: ReactDOMServer is not defined`... Will snoop. any thoughts in the interim?

exit2 2017-01-05T14:24:03.001722Z

Anyone here familiar with this error? Uncaught Error: Assert failed: (or (component? x) (reconciler? x))

2017-01-05T14:31:46.001723Z

@njj it's quite common when i'm doing something wrong.

2017-01-05T14:32:52.001724Z

Look at the stacktrace, it should tell you where the problem is.

tony.kay 2017-01-05T16:23:45.001729Z

@sova I'm using alpha47...perhaps it is fixed in later versions

tony.kay 2017-01-05T16:24:08.001730Z

@njj just means you passed something that was neither a component or reconciler to something (like transact!) that wanted a component or reconciler

exit2 2017-01-05T16:24:44.001731Z

(defroute foo-routes "/foo/:bar" [bar]
  (transact! @reconciler [(app/choose-tab {:tab :search})
                          (search/new-query {:status bar})
                              :ui/root]))
Iโ€™m passing the reconciler in this case

tony.kay 2017-01-05T16:25:27.001732Z

my guess is you don't have what you think you have...perhaps that is an untangled app instead?

tony.kay 2017-01-05T16:25:55.001734Z

in which case (:reconciler @app)

tony.kay 2017-01-05T16:26:23.001735Z

(js/console.log @reconciler)

exit2 2017-01-05T16:26:31.001736Z

perhaps the issue is: (def reconciler (atom nil))

tony.kay 2017-01-05T16:27:00.001737Z

possibly ๐Ÿ˜‰

exit2 2017-01-05T16:27:40.001738Z

this app was setup by a peer of mine who abstracted quite a bit, so unfortunately the documentation isnโ€™t 1 to 1 w/ what iโ€™m looking at

tony.kay 2017-01-05T16:27:57.001739Z

yeah, and your peer is still wrong in not quoting the transact data

exit2 2017-01-05T16:29:06.001740Z

Im gonna switch to om/transact versus his transact abstraction

exit2 2017-01-05T17:01:00.001741Z

@tony.kay I was able to get things working based off your todomvc example

tony.kay 2017-01-05T17:09:02.001742Z

@njj great

exit2 2017-01-05T17:09:34.001743Z

@tony.kay When using the quoted transaction vector, how do I parse params passed in from defroute?

exit2 2017-01-05T17:09:59.001744Z

it appears that is turning that param into a string, i.e. โ€œbarโ€ versus whatever param is passed in the actual url

tony.kay 2017-01-05T17:10:35.001745Z

read up on syntax quoting. In short:

(om/transact! r `[(app/f {:p ~arg})])

tony.kay 2017-01-05T17:10:56.001747Z

a backquote is a syntax quote...makes things literal. ~ is unquote

tony.kay 2017-01-05T17:11:17.001748Z

unquote lets just the thing that follow it come from the env outside of the quoted thing

exit2 2017-01-05T17:11:18.001749Z

(defroute foo-routes "/foo/:bar" [bar]
  (om/transact! @reconciler `[(app/choose-tab {:tab :search})
                             (search/new-query {:status ~bar})
                            :ui/root]))

exit2 2017-01-05T17:11:20.001750Z

something like this?

tony.kay 2017-01-05T17:11:22.001751Z

yep

exit2 2017-01-05T17:11:25.001752Z

sweet

tony.kay 2017-01-05T17:11:56.001753Z

single-quote is literal literal

exit2 2017-01-05T17:12:15.001754Z

Iโ€™m a JS dev, learning CLJS this is my first project w/ it

exit2 2017-01-05T17:12:30.001755Z

somethings like that were hidden from me, I guess to prevent having to explain it ๐Ÿ™‚

tony.kay 2017-01-05T17:12:39.001756Z

cool. Clojure for the Brave and True is a good online resource

tony.kay 2017-01-05T17:12:54.001757Z

quoting is leveraged mainly in macros

exit2 2017-01-05T17:13:37.001758Z

thanks again @tony.kay - really loving untangled

tony.kay 2017-01-05T17:13:46.001759Z

welcome. Glad you like it.

exit2 2017-01-05T17:27:01.001760Z

@tony.kay have any examples that donโ€™t use hash routing and doesnโ€™t case a full page reload?

exit2 2017-01-05T17:27:16.001761Z

I feel like thats what this is for.. https://github.com/venantius/accountant

tony.kay 2017-01-05T17:31:30.001764Z

I do not. Not really a concern of the framework itself. More about how you want to set up your app.

tony.kay 2017-01-05T17:32:30.001765Z

From my perspective, I really think "back" and "forward" should be no-ops in SPA. If you're writing an application on the desktop you don't have a "back button". Why should we have one just because it runs in a browser? Makes software a lot more complicated. We spend countless hours worrying over it, doing it poorly (because it is basically not cleanly solvable), and not adding the actual useful features users really need. Who is going to not use your product because back is a no-op, but your real features rock? Has anyone honestly stopped using a webapp because back didn't "undo" their prior operation? Does "back" in gmail compose/send unsend your message?

tony.kay 2017-01-05T17:32:55.001766Z

If you're browsing stateless documentation, sure...if you just pressed a button that executed a transaction on the server? WTF?

tony.kay 2017-01-05T17:33:04.001767Z

what is back gonna do?

tony.kay 2017-01-05T17:33:23.001768Z

I think we're doing ourselves a disservice by trying to map stateless doc browsing onto an application

tony.kay 2017-01-05T17:34:06.001769Z

I lean towards disabling back/forward, and just warn that page reloads are not what you want when you try them

tony.kay 2017-01-05T17:34:26.001770Z

Direct navigation to some part of the app seems OK, but the use is rather limited. I can see the benefit of being able to target part of an app from, say, an email link.

tony.kay 2017-01-05T17:35:13.001772Z

stepping off soap box now ๐Ÿ˜‰

exit2 2017-01-05T17:40:11.001776Z

catching up here ๐Ÿ˜„

exit2 2017-01-05T17:41:10.001778Z

@tony.kay how about no back button, but clicking a link like /foo/bar doesnโ€™t require a full page reload?

exit2 2017-01-05T17:41:14.001779Z

or is that sort of the same..

tony.kay 2017-01-05T17:41:29.001780Z

why do you need the URL to change? Why does it need to be a link at all?

tony.kay 2017-01-05T17:41:36.001781Z

it's an SPA

tony.kay 2017-01-05T17:41:42.001782Z

make the button change the state, which changes the view

exit2 2017-01-05T17:41:50.001783Z

bookmarking mostly

tony.kay 2017-01-05T17:41:52.001784Z

no linking involved...it ISN'T documentation

tony.kay 2017-01-05T17:41:57.001785Z

can you bookmark Excel?

exit2 2017-01-05T17:42:12.001786Z

its an internal tool, people want to be able to share links

tony.kay 2017-01-05T17:42:18.001787Z

it's trying to map a stateless doc concept onto an application

tony.kay 2017-01-05T17:42:37.001788Z

I understand. I know people write up requirements that way.

tony.kay 2017-01-05T17:42:42.001789Z

Yes, you can do it

tony.kay 2017-01-05T17:42:54.001790Z

I thought you already had that part, though

tony.kay 2017-01-05T17:43:09.001791Z

you should not be seeing full page reloads from, say, todomvc

tony.kay 2017-01-05T17:43:17.001792Z

the item filtering is done via URL

exit2 2017-01-05T17:43:44.001793Z

but todomvc uses hashroutes no?

tony.kay 2017-01-05T17:43:57.001794Z

OH. I see.

tony.kay 2017-01-05T17:44:04.001795Z

Yeah, you have to configure the browser to do that

tony.kay 2017-01-05T17:44:22.001796Z

again, not part of the framework itself, just standard HTML5 routing setup

exit2 2017-01-05T17:44:45.001797Z

ya its basically like โ€œ#/fooโ€ works in my current setup, but we want just โ€œ/fooโ€ type thing

exit2 2017-01-05T17:45:05.001798Z

cool Iโ€™ll look into it, Iโ€™ve seen it done in Angular, React, etc.. I believe

tony.kay 2017-01-05T17:45:18.001800Z

the google closure library is automatically available

tony.kay 2017-01-05T17:45:40.001802Z

accountant hacks in that way, I think

tony.kay 2017-01-05T17:46:31.001803Z

The one thing you'd have to fix though, is that you have to get the server to serve your index page independent of what URL it is asked for

tony.kay 2017-01-05T17:46:49.001804Z

cause otherwise if someone starts with that link, then the server will say page not found

exit2 2017-01-05T17:47:09.001805Z

cool, so it should just be able to be done by setting it up w/ html5history correctly and telling secretary not to use hash routes

tony.kay 2017-01-05T17:47:40.001806Z

and making sure the server will server index.html when asked for any URI

exit2 2017-01-05T17:47:48.001807Z

gotcha

tony.kay 2017-01-05T17:47:54.001808Z

(except /api, which is your untangled API channel)

2017-01-05T17:56:51.001809Z

We use pushy combined with bidi for URL routing. We need it for sharable/bookmarkable dashboards. I think it's an overreach to say SPAs in general don't need routing, but yeah, for the most part we only route the stuff that might be bookmarkable, not every single action.

exit2 2017-01-05T17:57:40.001810Z

@therabidbanana does your setup use secretary at all?

2017-01-05T17:57:52.001811Z

No - I think bidi takes the place of that

exit2 2017-01-05T17:57:58.001812Z

ok interesting.. thanks

exit2 2017-01-05T17:58:18.001813Z

I definitely need shareable/bookmark-able for the same reason as you

tony.kay 2017-01-05T18:01:44.001814Z

Thanks @therabidbanana . I agree that some things like that are needed. Like I said, more of a soap box sore spot ๐Ÿ™‚

2017-01-05T18:02:31.001815Z

Basically you hook up pushy to call a function on every route change, in our case it's basically just a direct call to om/transact! - but we have it tack on other actions besides (route/update) based on url (for example, some data we don't pull until you jump into a specific dashboard, so if you hit a dashboard route we can tack on an (untangled/load) in the transaction

exit2 2017-01-05T18:03:21.001816Z

@therabidbanana have an example you can share of the direct call on transact? I suspect my setup would be similar

2017-01-05T18:08:13.001818Z

So the key bit of code is in the update-fn we call in mount. mount is called with the reconciler during app initialization.

2017-01-05T18:08:52.001819Z

Handlers is the bit with the extra info to tack on to route transitions for untangled lazy loads.

exit2 2017-01-05T18:11:01.001820Z

:thumbsup:

2017-01-05T18:11:08.001821Z

Looks like pushy takes two functions when you initialize it - one for what to do on a match - update-fn, and one to transform url to match parameters that get passed into the update-fn, which we call url->route

2017-01-05T18:17:54.001822Z

To be fair to @tony.kay though - we needed routing as much to prove untangled could stand up to Ember.js as we did for actual usage of the feature. In general we probably have more routes than we need. ๐Ÿ™‚

exit2 2017-01-05T18:32:29.001823Z

@therabidbanana I was able to drop pushy in my project w/ existing code around secretary and have no hash routes ๐Ÿ˜„

2017-01-05T18:32:42.001824Z

Sweet

exit2 2017-01-05T18:49:22.001825Z

btw @tony.kay I forgot to mention, the project Iโ€™m working is with jason jackson

exit2 2017-01-05T18:49:26.001826Z

he said you might know him

tony.kay 2017-01-05T18:49:32.001827Z

@therabidbanana ah yes...must have routes in Ember, else we might forget where to pee

๐Ÿ˜‚ 1
2017-01-05T18:49:48.001828Z

Pretty much yeah

tony.kay 2017-01-05T18:49:54.001829Z

@njj sure! we've interacted a decent amount

exit2 2017-01-05T18:50:22.001830Z

haha re: Ember

exit2 2017-01-05T18:50:34.001831Z

it was like their #1 thing in that first instructional video

exit2 2017-01-05T18:50:46.001832Z

YOU MUST HAVE ROUTES, OTHERWISE CHAOS

2017-01-05T18:58:38.001833Z

there's now 3 engineers and 1 project manager on our untangled app ๐Ÿ™‚

๐Ÿ˜€ 1
tony.kay 2017-01-05T18:59:14.001836Z

Nice Jason

tony.kay 2017-01-05T18:59:26.001837Z

we're spinning up a staff of about 20

๐Ÿš€ 1
2017-01-05T19:44:21.001838Z

Well, to be fair to Ember, the router is Ember's version of the reconciler - a single source of truth in charge of the hard getting/synchronizing data stuff. The fact that it's tied to urls is more of a byproduct of just trying to have some reliable abstraction like that.