untangled

NEW CHANNEL: #fulcro
macrobartfast 2017-02-19T00:26:16.003313Z

figwheel is not seeming to work when running the todomvc client-only, and I'm getting an error code in chrome...

macrobartfast 2017-02-19T00:27:05.003315Z

any thoughts?

adambros 2017-02-19T00:38:59.003316Z

@macrobartfast cannot reproduce, i ran on 1d35cdb origin/client-only

$> lein do clean, repl
(start-figwheel)
and went to localhost:2345/dev.html

adambros 2017-02-19T00:39:48.003319Z

any other steps maybe?

adambros 2017-02-19T00:41:37.003320Z

oh, @macrobartfast, it looks like you were going to index.html as your code is minimized

adambros 2017-02-19T00:42:15.003321Z

if that’s correct, you had a bad cached version

adambros 2017-02-19T00:42:27.003322Z

if you reload with cache off you should get a 404

macrobartfast 2017-02-19T01:14:06.003323Z

badaboom... 'do clean' did the trick! thanks @adambros !

1✌️
macrobartfast 2017-02-19T01:36:58.003325Z

just ran the server version... everything has worked out of the box for both the client-only and server versions... this is awesome!

macrobartfast 2017-02-19T01:37:57.003326Z

pretty wonderful to be able to have all this working for me so quickly. 😀

1113
eric.shao 2017-02-19T02:32:52.003332Z

@baris Thank you for you reply.But did follow the Screenshots(two repl),and the http://localhost:3000/index-dev.html shows content (the login form). But the figwheel prompt did not connected, and the chrome console repeatedly show: WebSocket connection to '<ws://localhost:3449/figwheel-ws/dev>' failed: Establishing a tunnel via proxy server failed.

tony.kay 2017-02-19T02:35:26.003333Z

So, that message means that figwheel isn’t running where the js expects to find it

tony.kay 2017-02-19T02:35:55.003334Z

When you start the server on port 3000 with (go), that starts the server-side web server for the application.

eric.shao 2017-02-19T02:35:56.003335Z

The js has generated.

tony.kay 2017-02-19T02:36:09.003336Z

Figwheel is a tool that compiles the JS AND runs a websocket

tony.kay 2017-02-19T02:36:17.003337Z

it is started from the other REPL

tony.kay 2017-02-19T02:36:27.003338Z

(and shows a message that tells you figwheel is compiling)

tony.kay 2017-02-19T02:36:54.003339Z

If you’re seeing that error you either have an old cached version of the JS or figwheel isn’t running

eric.shao 2017-02-19T02:36:55.003340Z

yes all three js has compiled, dev cards test.

tony.kay 2017-02-19T02:37:27.003341Z

open dev tools in chrome and "disable js caching while devtools is open" in the settings

tony.kay 2017-02-19T02:37:32.003342Z

reload browser

eric.shao 2017-02-19T02:37:41.003343Z

did that.

tony.kay 2017-02-19T02:38:30.003344Z

do you have some weird network configs? proxy server? "Establishing a tunnel via proxy server failed."

tony.kay 2017-02-19T02:38:45.003345Z

that might just be a secondary error of figwheel…don’t know

tony.kay 2017-02-19T02:39:00.003346Z

See: http://developer.dynamsoft.com/dwt/kb/2891

tony.kay 2017-02-19T02:39:11.003347Z

maybe need to bypass proxy server?

tony.kay 2017-02-19T02:39:25.003348Z

well, that would have made the other page fail too I think

tony.kay 2017-02-19T02:41:21.003349Z

try loading from localhost:3449 and see if you get any response…the full stack ops won't work there, but it will tell you if figwheel is up

eric.shao 2017-02-19T02:42:37.003351Z

ok,let me try through from beginning again.

tony.kay 2017-02-19T02:43:41.003352Z

basically that is all there is to it: figwheel runs, generates (and instruments) js code with hot code reload capabilities (to be provided by figwheel on port 3449). You, however, run the server at :3000 for full-stack ops. Your code talks to port 3000, and the instrumented figwheel stuff hits 3449

tony.kay 2017-02-19T02:43:53.003353Z

the figwheel port can be configured in the figwheel section of the project file

tony.kay 2017-02-19T02:43:58.003354Z

I double-checked…it is not.

tony.kay 2017-02-19T02:44:06.003355Z

oh, make sure you’re using the develop branch

tony.kay 2017-02-19T02:44:13.003356Z

I think…let me check that

macrobartfast 2017-02-19T02:44:28.003357Z

is disabling js caching different than the usual devtools settings/preferences/disable cache... ?

tony.kay 2017-02-19T02:44:31.003358Z

actually master and develop are identical

tony.kay 2017-02-19T02:44:48.003359Z

@macrobartfast that is exactly what I mean, yes

tony.kay 2017-02-19T02:44:57.003360Z

it just ensures you don’t get old cached code

macrobartfast 2017-02-19T02:44:57.003361Z

ah cool, thx

tony.kay 2017-02-19T02:45:15.003362Z

You are aware of the YouTube getting started and in-the-large series, right?

tony.kay 2017-02-19T02:45:22.003363Z

all on the Untangled playlist

macrobartfast 2017-02-19T02:48:28.003364Z

I am, very helpful videos!

macrobartfast 2017-02-19T02:49:19.003365Z

I am about to truck ahead into video 3.

macrobartfast 2017-02-19T03:01:13.003366Z

is using the code snippet feature in here (using the + to the left of the slack input box) the right place to drop in large error messages, or does everyone have to see it? I'm used to using paste type services.

eric.shao 2017-02-19T03:01:22.003367Z

@tony.kay Finally the figwheel-prompt shows, thank you for your advice. The problem is my chrome’s vpn-plugin for sure. Whenever I disconnect that plugin the prompt will show.Thank you.

tony.kay 2017-02-19T03:01:36.003368Z

@eric.shao whew…lucky guess 😉

eric.shao 2017-02-19T03:01:58.003369Z

😄

tony.kay 2017-02-19T03:02:22.003370Z

@macrobartfast You could use a github gist…if you think a small portion of it is sufficient, then putting it in a `` ` block is good

macrobartfast 2017-02-19T03:04:27.003372Z

the support ticket feature isn't offering me the ability to walk back... offers 1 frame of 0, or 0 of 0, even after creating a number of to-dos...

macrobartfast 2017-02-19T03:04:36.003373Z

standby for error message from chrome.

tony.kay 2017-02-19T03:07:14.003374Z

it could be the code needs some kind of update. No one has touched that code for the better part of a year. Could be it is in need of some update love. The error may help

macrobartfast 2017-02-19T03:09:11.003375Z

ah ok

macrobartfast 2017-02-19T03:09:29.003376Z

here's the error (sorry for the delay... getting up to speed on using gists for this):

tony.kay 2017-02-19T03:10:08.003378Z

what is in your network tab

tony.kay 2017-02-19T03:10:11.003379Z

any errors there?

macrobartfast 2017-02-19T03:10:51.003380Z

no errors there

tony.kay 2017-02-19T03:10:59.003381Z

this doesn’t look like an actual problem…it looks like underdocumented “how to use” and poor error handling in our code 🙂

macrobartfast 2017-02-19T03:11:07.003382Z

btw, this is just something I'm checking out because it's cool... this is not a priority ;-D

tony.kay 2017-02-19T03:11:18.003383Z

I’m guessing nothing is wrong with the code

macrobartfast 2017-02-19T03:11:32.003384Z

I should be focusing on the videos, anyway.

tony.kay 2017-02-19T03:11:33.003385Z

So, when you created a “support ticket” it showed an ID in the js console

macrobartfast 2017-02-19T03:11:51.003387Z

it did... http://localhost:3000/support.html?id=4f28eda9-13c8-4fa2-841f-98fda2ff7c0d

tony.kay 2017-02-19T03:11:57.003388Z

when you start the support viewer, you have to supply that ID as a parameter in the URL. yes, that

macrobartfast 2017-02-19T03:12:11.003389Z

of course I want to see this totally sweet thing working, but I can wait!

tony.kay 2017-02-19T03:12:18.003390Z

mmmm. is that the right ID?

tony.kay 2017-02-19T03:12:27.003391Z

that sounds like an Om transaction ID

tony.kay 2017-02-19T03:12:33.003392Z

I don’t remember using UUIDs for that

macrobartfast 2017-02-19T03:12:34.003393Z

aha... let me get the log entry

macrobartfast 2017-02-19T03:12:53.003394Z

[995.238s] [om.next] transacted '[(support-viewer/send-support-request {:comment "yoodle"}) (support/toggle)], #uuid "66227ac9-6894-456e-aa1f-4d012f4b0780"

tony.kay 2017-02-19T03:13:00.003395Z

oh wait…the SERVER log

macrobartfast 2017-02-19T03:13:05.003396Z

aha lol

tony.kay 2017-02-19T03:13:09.003397Z

not the JS log

tony.kay 2017-02-19T03:13:09.003398Z

my bad

macrobartfast 2017-02-19T03:13:19.003399Z

no, probably my bad, lol

tony.kay 2017-02-19T03:13:21.003400Z

the server will tell you what it created…use THAT ID 🙂

macrobartfast 2017-02-19T03:13:42.003401Z

I am laughing at myself in this coffee shop, looking positively crazy

tony.kay 2017-02-19T03:14:00.003402Z

the intentional use-case is the server would send you an email saying “support case such-and-such” with a clickable URL

tony.kay 2017-02-19T03:14:04.003403Z

only the server needs to knwo the ID

tony.kay 2017-02-19T03:14:19.003404Z

though I guess you could tell the user “Case ID #5 was submitted"

tony.kay 2017-02-19T03:15:59.003405Z

The coolest thing about that feature is that it took almost no code to make it happen…the model of Om just makes it possible, essentially for free

macrobartfast 2017-02-19T03:16:29.003406Z

it's freaking awesome

macrobartfast 2017-02-19T03:16:55.003407Z

by the way, you said exactly what to do in the readme: '...a support ID in the server logs...'

macrobartfast 2017-02-19T03:18:13.003408Z

I'm still getting 1 of 0 frames via http://localhost:3000/support.html?id=1006, but I should rebuild and restart everything as that may resolve this

macrobartfast 2017-02-19T03:18:44.003409Z

I mean, I've been a bit rambunctious in setting all this up.

tony.kay 2017-02-19T03:19:14.003410Z

yeah, it should work. The error you were seeing was because there was no data in the request…the code was written rather quickly…lots of important things to build. Examples sometimes get the short shrift

tony.kay 2017-02-19T03:19:24.003411Z

so, the error isn’t very useful

macrobartfast 2017-02-19T03:19:35.003412Z

but I will be eager to get it working at some point, as it's going to be super sweet to demo it.

macrobartfast 2017-02-19T03:20:37.003413Z

it's a great selling point on using the stack for those for whom the other advantages of clj/cljs may be a bit foggy.

macrobartfast 2017-02-19T03:21:30.003414Z

but for now, as I said, I'll keep going on the basics, using the videos, which I greatly appreciate.

tony.kay 2017-02-19T03:21:46.003415Z

when you demo it, realize that there is a way to do the VCR with any js app: record the dom deltas at every event. There are even commercial products to do so. The cool thing about our approach is that you have the actual application state…you can actually fix bugs against the figwheel-run support viewer and watch the user’s error disappear from the view they were looking at

tony.kay 2017-02-19T03:23:52.003418Z

Talk about the ultimate in “error case reproduction"

tony.kay 2017-02-19T06:25:24.003421Z

Just FYI: on SNAPSHOT I just fixed a bug in routing-tree. That function was not shown in the devguide, but I’d added it for easier use, but messed up on its implementation. Should not affect you if you’re using the devguide, but will affect you if you found it and used it.

tony.kay 2017-02-19T08:18:40.003422Z

@baris @darrellesh The develop branch of untangled-ui now has a devcard showing a simple full stack form. It starts out loading multiple things from a server (which have not been augmented with form support). It then lets you click on them from a table display, initializes them into the form support, and let’s you edit. It also demonstrates simple full-stack updates. See form-demo-cards https://github.com/untangled-web/untangled-ui/blob/develop/src/guide/untangled/ui/form_demo_cards.cljs

1👍
tony.kay 2017-02-19T08:27:24.003424Z

The main things that are still missing from form support: 1. more documentation/examples 2. more built-in form components (only have text field and dropdown written…oh, and checkbox I think) 3. maybe a built-in “vertical form” render that can generate a full-blown UI for you with some stock look-and-feel as a convenience when you want something that just looks like a standard form. 4. More built-in validations (1) is already decent, but incomplete. (2) and (4) are made to be extensible, so the existing examples are sufficient for any serious user. (3) is a nice-to-have, but most ppl will use it as a placeholder or example for making their own reusable declarative form generators.

tony.kay 2017-02-19T08:28:42.003425Z

If you’re going to use form support “for real”, then I’d suggest becoming a contributor of the things you immediately need in (2) and (4). (3) requires that we finish the UI stuff in general.

2017-02-19T10:38:51.003433Z

@tony.kay for sure about 2 and 4. The current state of the forms component is nearly complete for me, just missing some few things like the capability for file (images) uploads.

2017-02-19T10:41:47.003434Z

I totally agree with you about 3. It's an easy step when the basic ui components are finished. The entire untangled story gets so powerful after that and I'm looking forward to that.

torkan 2017-02-19T16:24:30.003436Z

Hi! Just starting out with Untangled/Om Next here, and I’m trying to ascertain best practices from the get-go.. When creating for example a LoginForm-component, is the preferred way to get the values of the subcomponents (eg username/password) through using om.dom, setting :ref’s on those subcomponents and then accessing the values through om.dom/node?

torkan 2017-02-19T16:28:11.003437Z

In plain React, the preferred pattern would be to create some local state in the main component, and add onChange-listeners in the subcomponents to update the main component’s state, which would bypass the need for react refs

torkan 2017-02-19T16:31:10.003438Z

And most of the docs/tutorials I’ve seen so far are about more advanced topics, regarding the app state and the reconciler etc 🙂

tony.kay 2017-02-19T17:41:42.003439Z

@torkan So, it is different than that. Neither is the answer. The answer is that Om Next/Untangled require you do some understanding up front of the overall model. It may sound “more advanced”, but in fact the overall model makes everything simpler. It does require more learning up front. The Quick Introduction in the Untangled Dev Guide is your best bet

tony.kay 2017-02-19T17:42:04.003440Z

http://untangled-web.github.io/untangled/guide.html

tony.kay 2017-02-19T17:43:16.003442Z

@baris File uploads…hoping the image library component helps people see how to build that if the one we supply isn’t enough. We’ll get the docs out on the new modular server support ASAP.

torkan 2017-02-19T17:48:37.003443Z

@tony.kay Thanks for replying 🙂 I’ve run through most of the devguide (at least up to section G), so I have the main concepts about the app state pretty much down, I was thinking that this is the sort of use-case where you don’t want to update the app-state on every keypress by the user, and should rather rely on local state

tony.kay 2017-02-19T17:49:24.003444Z

Ah, I see. That is a very common question. Yes, component local state is there, and you can use it if you’re experiencing performance problems with something that updates rapidly.

tony.kay 2017-02-19T17:49:43.003445Z

defui makes a standard React component that can use the complete set of React features

torkan 2017-02-19T17:49:54.003446Z

However, I have failed to see an example that handles an input field in that way in your docs, or in Om Next’s, I might have just missed it though 🙂

tony.kay 2017-02-19T17:50:01.003447Z

But, as soon as you break away from the app state, you lose your ability to see those interactions in the support viewer.

torkan 2017-02-19T17:50:58.003448Z

Yeah, the reason I don’t want to put it in the app state, is precisely due to this, seeing every state update due to filling in fields are probably not that useful

tony.kay 2017-02-19T17:51:06.003449Z

So, for example, in untangled-ui (not quite officially released yet) there is form state support. That feature would not be nearly as clean if the form data wasn’t being completely managed at the app-state level.

torkan 2017-02-19T17:51:10.003450Z

(in the support viewer)

torkan 2017-02-19T17:51:40.003451Z

Ah ok, so putting it all in the app-state is the way to go after all then?

tony.kay 2017-02-19T17:52:06.003452Z

We’ve talked about “compressing history” as well, where transacts could be labeled as compressable, and more than one of those in sequence could be elided from the history on support requests.

tony.kay 2017-02-19T17:52:31.003453Z

Also, you cannot visually regression test components if the state isn’t coming through props

tony.kay 2017-02-19T17:52:55.003454Z

they are no longer pure functions

tony.kay 2017-02-19T17:53:29.003455Z

so, I use component local state rarely. One example might be a graphical representation (e.g. drag n drop) where it is just too slow otherwise

torkan 2017-02-19T17:53:42.003457Z

Yeah, that would be super-useful… I’ve used both Redux DevTools and Redux-form (which handles all form state through the redux state object)… Redux DevTools has a filter feature that basically allows you the same functionality

tony.kay 2017-02-19T17:53:58.003458Z

so, only give up the benefits of pure rendering when performance won’t let you do anything else

tony.kay 2017-02-19T17:54:26.003459Z

Yeah, these ideas are catching on everywhere. Immutable state and pure rendering rock

torkan 2017-02-19T17:57:00.003460Z

Yup, that’s the main reason I decided to build my next project with Untangled, achieving all these concepts comes much more naturally and unforced with cljs/om/untangled, doing it in JS is a lot more cumbersome

torkan 2017-02-19T18:02:34.003461Z

What is the current state of untangled-ui? Still relatively safe to start using, even though it’s not officially released yet, or?

tony.kay 2017-02-19T18:03:31.003462Z

So, untangled ui is in a bit of flux as far as the CSS and wrappers go. The forms support isn’t changing (but may have bugs…and is missing stuff as described earlier). The image library works but is undocumented.

tony.kay 2017-02-19T18:04:05.003463Z

It is on clojars in a SNAPSHOT form. I don’t plan to rename things, but argument lists might change slightly or expand.

tony.kay 2017-02-19T18:04:33.003464Z

So, “safe to use” is “yes”, as long as you’re willing to tweak as we go.

tony.kay 2017-02-19T18:05:23.003465Z

for example, we changed our minds on elements/ui-button on friday, and change the arglists and CSS to support more pure semantics so the CSS could be more easily themed and the API could be a bit more natural for the programmer.

tony.kay 2017-02-19T18:05:41.003466Z

The layout responsive grid stuff is solid (but will get richer). The media selector stuff is also solid in layout/rwhen

tony.kay 2017-02-19T18:07:12.003470Z

We’ve removed the inclusion of the generated CSS from Git (as should be the case for generated files). So you have to use the README.css instructions to generate it.

tony.kay 2017-02-19T18:07:51.003471Z

The JAR generation story will include a build of it that will package the default CSS, but that is on the TODO list

tony.kay 2017-02-19T18:08:09.003472Z

mostly we expect people will want to edit the settings and generate app-specific themed CSS

tony.kay 2017-02-19T18:09:30.003474Z

We’re also toying with dropping the external CSS altogether and moving to co-located CSS generated dynamically with the components. Then you’d configure the theme via CLJS variables and we can get rid of all of the crap necessary to make the external CSS.

tony.kay 2017-02-19T18:09:58.003475Z

via this: https://github.com/untangled-web/om-css

torkan 2017-02-19T18:10:19.003479Z

Cool! I’ll check it out then 🙂

tony.kay 2017-02-19T18:10:58.003482Z

that’s a bit off in the future, but it would have some cool advantages.

tony.kay 2017-02-19T18:11:15.003483Z

So many things for aspiring OSS contributors to help with 😉

torkan 2017-02-19T18:12:02.003484Z

One caveat with the css module approach (at least if you are creating hashed classnames etc), is that you require a full rebuild if you have an app that is to be shipped with various themes

tony.kay 2017-02-19T18:12:36.003485Z

The themes are variable settings that are evaluated at runtime

torkan 2017-02-19T18:13:48.003486Z

Could probably be solved with some fancy server-rendering which sets everything up first I guess, I haven’t looked into that stuff yet 🙂

tony.kay 2017-02-19T18:13:51.003487Z

Theming could just update those values and re-emit the CSS to the DOM

tony.kay 2017-02-19T18:13:56.003488Z

not server-side at all

torkan 2017-02-19T18:14:00.003489Z

Aah

tony.kay 2017-02-19T18:14:14.003490Z

It just becomes part of your minified JS file

tony.kay 2017-02-19T18:14:30.003491Z

and the CSS would be data, which isn’t rewritten by Closure

torkan 2017-02-19T18:17:28.003492Z

Got it… We tried out the module approach for one of our apps at work, it became a little tedious as we have multiple instances of the same app for different customers (with different theming), and we basically have to rebuild everything if we just did some minor css updates

tony.kay 2017-02-19T18:20:39.003493Z

well, depending on the change, this would require you to recompile the app (since the CSS is in the app)

torkan 2017-02-19T18:20:54.003494Z

This presupposes that you don’t want to burden the client with a lot of unused css of course 🙂

tony.kay 2017-02-19T18:20:59.003495Z

if it were just color changes/font/spacing, then you could easily use js variables (set in the header before load) to theme and have your cljs read those as the settings

tony.kay 2017-02-19T18:23:15.003500Z

imagine instead of ’blue using something like js/color

tony.kay 2017-02-19T18:24:03.003502Z

the local-kw helper just namespaces the class to the component

torkan 2017-02-19T18:24:05.003503Z

Yeah, it’s unfortunately more cumbersome than that, so we ended up with just building separate css-files, and have the deployment-scripts pick a css-file to include in index.html depending on the instance

tony.kay 2017-02-19T18:24:47.003504Z

ah, well, when your requirement complexity exceeds the abilities of your tools...

tony.kay 2017-02-19T18:25:23.003505Z

find a way to convince the sales people/clients of a simpler solution 🙂

torkan 2017-02-19T18:25:45.003506Z

Haha yes, the permanent state of any front-end dev 🙂

tony.kay 2017-02-19T18:25:53.003507Z

e.g. do you really need that insignificant tweak to the look that costs twice as much?

tony.kay 2017-02-19T18:26:09.003508Z

well, if you put $$$ to it, a lot of times they’ll agree

tony.kay 2017-02-19T18:26:21.003509Z

“Yes, we can do that, but it’s $$ more"

tony.kay 2017-02-19T18:28:11.003510Z

Usually these are process/people problems. You can only solve those with non-technical means…e.g. track exactly how much it is costing the company, and make that known to the accountants. They’ll want to pass that along via sales, which makes the sales guy want to sell it differently

tony.kay 2017-02-19T18:28:42.003511Z

unfortunately, that usually happens after you’ve already signed contracts that have doomed you to suck-dom

torkan 2017-02-19T18:28:44.003512Z

For our situation, it’s that we are one of the biggest universities in the country, and we provide a set of services for both ourselves and a lot of other academic institutions… And all those institutions of course already have a general theming to all their online services, so we have to adhere to them 🙂

tony.kay 2017-02-19T18:29:02.003513Z

Ah. Well, that does make it harder

torkan 2017-02-19T18:31:30.003514Z

Yeah, they pay for it though, it’s just that we have to ensure we have a sensible way of serving tailor-made css to all of them, and avoiding the inclusion of all of the irrelevant themes in the builds

torkan 2017-02-19T18:32:06.003515Z

But you’re using the BEM-approach so far in untangled-ui, so it’s all good 🙂

tony.kay 2017-02-19T18:34:31.003516Z

Yeah, our CSS guy is pretty good, and we’re trying to make everything easy to augment. Everything allows the addition of your own CSS classes alongside the ones the helpers (like ui-button) add

torkan 2017-02-19T18:42:36.003517Z

I’ll try it out, looks good (like the rest of Untangled)!

tony.kay 2017-02-19T18:43:08.003518Z

Thanks. It’s getting there

2017-02-19T22:43:50.003520Z

Speaking of om-css, are there plans to make is available in #?(:clj ..)? Thanks for the dev guide by the way, most approachable resource to learn om 🙂

tony.kay 2017-02-19T23:49:27.003521Z

@nha the library is tiny (126 lines of code). It would take very little time to make it ss rendering compatible. Not using it at the moment. The whole om-css things was more of a side thought that you could easily do without a library, but be glad to take a PR.

1