untangled

NEW CHANNEL: #fulcro
tony.kay 2017-07-01T03:26:38.453260Z

I’m not certain how I would test SSR with merge alt unions, given that the alternates cannot be reached unless you run the app. The main path is always initialized (e.g. the default branch of the union). I think that’s why I originally hadn’t bothered porting it. Oh, but then perhaps SSR wasn’t working because the symbol was missing? Anyway. It is ported

tony.kay 2017-07-01T07:43:23.612627Z

Untangled spec alpha4 snapshot pushed to clojars. Server-side tests rendered in the browser now show compile errors (in the browser). These were getting swallowed, making it hard to fix a test when there were syntax problems.

tony.kay 2017-07-01T07:43:49.613863Z

@adambros has a fix for sorting (failing specs don’t maintain order). I expect a push soon.

cjmurphy 2017-07-01T08:41:18.804839Z

I have put some of the code from here: https://github.com/awkay/untangled/blob/d6fe2a49cfb21ce16e6a8e521a710bd0d61fb654/src/devguide/untangled_devguide/O01_Forms_The_Basics.cljs into my own application. To the add-phone mutation I've added (remote [env] true). (Just as an experiment). Was hoping to see the same mutation on the server side being called. Instead I'm seeing 'Cannot write Function' as a client side error message in some stack trace that includes marshalling. I'm guessing the solution will be to muck with the AST and get rid of this mysterious function so it doesn't get sent across. Probably my next step will be to look at what the send function is actually trying to send across, looking for anything that isn't just data. Anyone experienced this before?

mitchelkuijpers 2017-07-01T08:54:28.848646Z

@cjmurphy that probably means you have a function in the form state somewhere which it is trying to marshall to transit

mitchelkuijpers 2017-07-01T08:55:15.851474Z

So I would print the state and see where the function is in the app-state and see if you can remove that (since you should not put functions in your app-state

mitchelkuijpers 2017-07-01T08:56:09.854445Z

Also i would not add remote true to add-phone but use the provided function from form-support to persist the entity

mitchelkuijpers 2017-07-01T08:56:56.856873Z

commit-to-entity!

cjmurphy 2017-07-01T10:44:07.222223Z

Thanks @mitchelkuijpers. I checked my app state and no function inside. However as you point out I was taking the wrong approach anyway. I looked for the commit-to-entity! call and just added in :remote true, so call from the [Submit] button is now #(f/commit-to-entity! this :remote true). I found the instructions as to what to do on the server side here at /src/devguide/untangled_devguide/O03_Forms_Server_Integration.cljs.

cjmurphy 2017-07-01T10:46:22.230160Z

Everything seems to work when I press [Submit], however I don't see the message "Mutation for ", that was hoping to see.

mitchelkuijpers 2017-07-01T11:03:22.289844Z

@cjmurphy Do you have a [untangled.ui.forms :as f] required in the namespace where you defined the f/commit-to-entity

cjmurphy 2017-07-01T11:04:00.291989Z

Yes I do.

cjmurphy 2017-07-01T11:05:35.297866Z

At first I tried a defmutation but the f part at the beginning failed the spec for defmutation. So I looked up server-mutate as the actual name of the multimethod.

mitchelkuijpers 2017-07-01T11:06:11.299875Z

Not sure how that part works we don;t use that yet we have defmethod on our own defined mutate multimethod

cjmurphy 2017-07-01T11:07:58.305748Z

There would have been a complaint if no method defined for f/commit-to-entity.

cjmurphy 2017-07-01T11:12:04.320015Z

Actually that is not true. I took away the particular defmethod/defmutation altogether, and no complaint. So it is still likely I just haven't been able to set it up right.

tony.kay 2017-07-01T13:35:41.862299Z

@cjmurphy You’ve got the right shape. Commit only sends a delta (so were there edits?)

tony.kay 2017-07-01T13:36:31.865941Z

The 010 Full Stack Demo is still working, I assume, and it shows both client and server code.

cjmurphy 2017-07-01T14:44:37.176502Z

Yes I'd better try out some working code. I just gave the person (you!) a new phone number (like a few numbers, like 55555 - not a proper US phone number) and pressed [Submit]. There seems to be a silent failure somewhere. Perhaps in copying across I didn't get all the validation hooked up properly - I'll make the validation be sumfin easy like single digit and make sure 'bad validations' are thrown up before looking at the mutation across the wire. I know the networking is working fine as reads are coming across.

cjmurphy 2017-07-01T15:22:28.362765Z

I worked it out. The problem was I was using timbre/info on the server rather than trusty println.

tony.kay 2017-07-01T15:57:25.533603Z

Untangled Spec has been migrated to my namespace. Repository is now here: https://github.com/awkay/untangled-spec

claudiu 2017-07-01T16:10:28.604745Z

@tony.kay will start playing with SSR for my use-case 🙂 thank you.

claudiu 2017-07-01T16:11:29.609887Z

is the u-spec migration temporary or is that it’s new location ?

tony.kay 2017-07-01T16:13:06.618042Z

depends on Navis. They are not maintaining the untangled-web github group, but they technically own it. So, I’m forced to move things I’m going to maintain to my namespace at the moment. If they ever give me some kind of written permission to use the untangled-web accounts on github, then I can use that, which would be preferable since that is where ppl know to look and search engines point to

tony.kay 2017-07-01T16:13:55.622076Z

I could rename untangled and make a new group (untangled is already taken, as is untangled-web)…but I’d still want them to at least take down the out-of-date resources.

tony.kay 2017-07-01T16:14:16.623725Z

but they do not seem in any hurry to do anything…even return my emails

tony.kay 2017-07-01T16:24:38.676107Z

Both Untangled and Untangled Spec version 1.0.0-beta1 just release to clojars. NOTE: New dependency name for spec. https://github.com/awkay/untangled-spec https://github.com/awkay/untangled

tony.kay 2017-07-01T16:25:27.680377Z

The contributing guide was also updated for Untangled to tell you how to run tests for server and client

claudiu 2017-07-01T16:30:43.706018Z

ohh 😞 would be awesome if they accepted, github starts usually factor in to choosing a library also, but not that big of a deal as long as the repo is active 🙂

tony.kay 2017-07-01T16:33:15.718330Z

how do you measure a start? it isn’t a fork, and the commit history goes back to 2015

tony.kay 2017-07-01T16:34:20.723587Z

but I do have some hope that they’re just busy and will come around. In the meantime, I want the project moving forward

claudiu 2017-07-01T16:42:37.764606Z

agh sory typo meant github stars 🙂

tony.kay 2017-07-01T16:42:54.765947Z

ah…yeah, those are nice to have

⭐ 1
cjmurphy 2017-07-01T18:53:41.385698Z

Hmm - it wasn't actually timbre/info to blame. It was me not realising that only way to get the data to the server was to press [Validate] then press [Submit]. Just [Submit] alone was doing nothing.

tony.kay 2017-07-01T18:56:05.396541Z

@cjmurphy Yes, you should make sure you understand the design. Validation is a separate step under your control.

tony.kay 2017-07-01T18:57:16.401891Z

The fields are tri-state, so auto-validating the whole form all the time would cause errors to show up on fields the user has not interacted with yet. So, you need to hook in logic at the appropriate point (event) and run whole-form validation…and not light up “submit” until that has happened, and all is valid

tony.kay 2017-07-01T18:57:54.404790Z

Or you could light up the submit button, but make sure the transact on it checks validation before trying to really commit

cjmurphy 2017-07-01T19:05:12.439654Z

Yes I don't need any validation for the moment. I just assumed that for the code I copied across if you just hit [Submit] then validation would happen automatically. Something I'm stuck on right now, separate issue: Is it okay to call df/load from a mutation? I'm thinking to pass in the component to the mutation because of what df/load needs as its first parameter.

cjmurphy 2017-07-01T19:20:16.508709Z

The mutation in question is populating a drop down. But needs to do a load for the selected value of the drop down.

cjmurphy 2017-07-01T19:45:14.618923Z

I found this text: "By contrast, load-action, load-field-action, and load-data-action do not call om/transact!, but can be used to initialize a load inside of one of your own client-side mutations." So seems like I need load-data-action, as need to construct a query to get exactly same behaviour as load: [({server-property (om/get-query SubqueryClass)} params)]. But load-data-action no longer seems to exist in untangled.client.data-fetch. Been renamed, rationalised?

tony.kay 2017-07-01T23:11:37.437972Z

load-action

tony.kay 2017-07-01T23:11:58.439132Z

all of the load-data was deprecated a while ago. I need to update the docs. In the 1.0 release I finally removed it.

tony.kay 2017-07-01T23:12:24.440533Z

If there is any kind of outcry I can add it back. I think the API story is clearer without it though.

tony.kay 2017-07-01T23:12:36.441133Z

@cjmurphy

tony.kay 2017-07-01T23:14:32.447279Z

Polishing documentations and doing a lot more stuff with forms is next on my list.