untangled

NEW CHANNEL: #fulcro
tony.kay 2017-02-18T00:23:34.003257Z

@baris I'd love it if you play with it, actually. The docs are a bit sparse, but if you pay attention to the app state you'll "get it" I think

tony.kay 2017-02-18T00:24:01.003258Z

The idea is that when you go to merge new things into app state that should be form-capable, you should augment the data via build-form

tony.kay 2017-02-18T00:24:44.003259Z

I don't remember if you use init-form vs build-form...just look at the API. Basically, it will need the component

tony.kay 2017-02-18T00:24:58.003260Z

Also, server-side rendering support isnt' right yet, so you'd want to use cljs only for now

tony.kay 2017-02-18T00:25:21.003262Z

I'll fix that very soon. Forms is what I'm working on documenting.

tony.kay 2017-02-18T00:25:35.003263Z

I may yet find issues, but the API should not really change

tony.kay 2017-02-18T00:25:42.003264Z

except maybe a name clarification or two

tony.kay 2017-02-18T00:32:55.003265Z

@baris, so to answer your actual question:

tony.kay 2017-02-18T00:34:21.003266Z

that is unrelated to forms, and more of an untangled question.

tony.kay 2017-02-18T00:35:15.003267Z

1. When populating your table, just use regular data, as you already do (so TableRow might share the same ident as your EventForm...they are just different ways of viewing the same data in your app state)

tony.kay 2017-02-18T00:35:41.003268Z

2. When you click on a row, run a mutation like (edit-event {:id id})

tony.kay 2017-02-18T00:36:42.003269Z

3. The edit-event mutation will: a. swap/update the event entity with that ID using build form. This will copy the current state into the pristine area of the app state for forms and add general forms support to that entity...something like (swap! state update-in [:events/by-id id] build-form)

tony.kay 2017-02-18T00:38:01.003270Z

b. Place the ident of the selected event into the parent of the event form as :selected-event...e.g. Editor query might be [{:selected-event (om/get-query EventForm)}].

tony.kay 2017-02-18T00:38:29.003271Z

Step 3b basically updates the UI graph so that :selected-event points at the same exact entity that the table row pointed at

tony.kay 2017-02-18T00:38:43.003272Z

but 3a first puts the form support data INTO that entity

tony.kay 2017-02-18T00:38:52.003273Z

4. Change your UI routing to show the form, whose :selected-event now points to the augmented form, and renders the form

tony.kay 2017-02-18T00:40:23.003276Z

Om/Untangled kind of unify the approach to everything to the same set of operations: Muck with the entity, update the graph. Most everything else takes care of itself.

tony.kay 2017-02-18T00:42:15.003278Z

Occasionally, when a mutation will cause UI changes that are unrelated to where the transact ran, you have to include query keywords in the mutation to get a refresh of those other data-driven components....but the mutation makes if obvious what is changing, so building that list is always abstract: query keywords to do with the data that is changing.

2017-02-18T01:05:23.003281Z

Ok gotcha. Step-3 was the missing link. Thank you @tony.kay for the step by step explanation. I will try it.

eric.shao 2017-02-18T14:04:27.003288Z

Trying “untangled-template” , follow the instructions in IDEA-Cursive. But whenever I visit localhost:3449 or localhost:3000 (the web shows) the prompt doesn’t show and the browser-console shows WebSocket connection to '<ws://localhost:3449/figwheel-ws/dev>' failed: Establishing a tunnel via proxy server failed. Please advise me.🙂

2017-02-18T16:11:56.003289Z

You need two repls. A server and a figwheel repl as described in the Readme.

2017-02-18T16:15:51.003290Z

Start the server repl with 'lein repl' and then run the function (go) to start the server

2017-02-18T16:16:48.003291Z

Open a second repl again with 'lein repl' and run the function (start-figwheel) to start figwheel

2017-02-18T16:18:24.003292Z

Now you can navigate to http://localhost:3000/index-dev.html

2017-02-18T16:19:39.003293Z

Obviously you have to run the above commands in two terminal sessions

2017-02-18T16:21:06.003294Z

Or setup and run the commands in Cursive by following the Screenshots in the readme.

macrobartfast 2017-02-18T20:12:18.003296Z

I just downloaded the to-do app; any docs or tips for running from the repl or, in my case, cider/emacs?

macrobartfast 2017-02-18T20:12:38.003297Z

still getting up to speed and there are a lot of (awesome) options.

macrobartfast 2017-02-18T20:18:15.003298Z

I've downloaded the code; run lein build; and then lein repl... from there I would normally connect via cider and run something like (run-dev) or (-main) from the cider repl, just to give you an idea of how lost I am.

macrobartfast 2017-02-18T20:18:49.003299Z

of course, those things just produce exceptions, and the project.clj is a bit over my head at this point.

macrobartfast 2017-02-18T20:20:29.003300Z

also, I watched the getting started video for the todo example, and I think there was a mention of a 'client-only' branch, but I didn't see that branch... was I supposed to just create a new branch and work off it?

macrobartfast 2017-02-18T20:24:12.003301Z

I did find https://youtu.be/N4sSX1qmN80?list=PLVi9lDx-4C_T_gsmBQ_2gztvk6h_Usw6R&amp;t=158 but I don't know how to translate the settings into emacs/cider land.

macrobartfast 2017-02-18T20:30:40.003302Z

disregard my question about the client-only branch; I hadn't downloaded all the available branches.

macrobartfast 2017-02-18T20:32:44.003303Z

aaaaaannnd disregard the rest of my questions: your instructions on the todomvc github page did the trick. forgive me for not spending more time before I asked. ;-D

macrobartfast 2017-02-18T21:19:16.003304Z

what's the way to share code snippets/error messages, preferably, in here?

macrobartfast 2017-02-18T21:19:41.003305Z

omg, sorry... on a roll today... just found it.

macrobartfast 2017-02-18T21:42:16.003306Z

figwheel is not reloading... hmm... followed https://github.com/untangled-web/untangled-todomvc/tree/client-only, got it running in a browser window... should edits to untangled-todomvc/src/client/untangled_todomvc/ui.cljs hot reload in the browser window? I changed, as an example, the 'Double-click to edit a todo' copy and didn't see it reload.

2017-02-18T22:56:54.003308Z

Is this: https://github.com/untangled-web/om-css compatible with "plain" om components? (I am aware of https://github.com/ladderlife/om-css but don't really like that it requires it's own defui)

2017-02-18T23:08:53.003312Z

Ah - it says so at the top " A composable CSS module for co-locating component CSS with stock Om Next and Untangled UI components.".