inside m/muate, is it safe to do (swap! state ...) instead of om/transact! ?
yes, as long as you are in the :action
thunk
and you shouldn’t transact in a mutation
okay, because earlier osmeone told me to always use om/transact! instead of swap!
but I guess that's only true for doing pure om/next
umm, my guess is that they meant in your ui
once you are in a mutation you kinda need to swap
@qqq you job from this point forward is to advocate for the screen casts to newbies that ask questions that they answer 😉
@tony.kay: we can run your videos through a speech->text system, build an index of keywords, and whenever someone asks a question, link them to the youtube video w/ correct timestamp
go for it!
@adambros : so you a "sane" setup: ui.cljs should have om/transact! but no swap!, while mutations.cljs should have swap! but no om/transact! ?
transact is about abstract transactions...mutations are the impl of those abstractions, so of course they do swap
for anyone else curious: if you want a basic minimal server: https://github.com/untangled-web/getting-started-video/tree/basic-server
(reset! c.m.core/app (uc/mount @c.m.core/app ui/Root "app")))
<-- I know that this line got executed (console logs before/after)
however, nothing is installed in my div with id="app"
how do I debug this?
why is this not rendering? https://gist.github.com/anonymous/ac3792c567783d798d574440bb6d078c (entire project)
got it working, the hd should be a h1
do I need org.omcljs/om on the server side?
(it pulls in a bunch of *.jars, which I don't want as it slows down deployment / jvm startup on GAE)
server-side: sort-of. You want the parser, though you could implement something yourself or just copy in that code.
The easiest thing to do is include it. Also server-side rendering requires it
of course
my server side depenency went form "just clojure.jar" to 43MB of JARS 😞
oh well, I ugess I accept it
========== where in https://github.com/untangled-web/getting-started-video/tree/basic-server/src/server/app is the line where we fire up a http handler to handle "/api" GET requests?
@tony.kay: regarding dependencies on server side; assuming I am willing to put in the work, would it be possible to parser queries into AST on the client side, send the raw AST over as edn, and rip out the om dependency on the server side?
is there any fundamental reason why queries must be parsed where the data is , or can we parse the queries statically without seeing the data?
I think you're making your life miserable for very wrong reasons
but yes, of course you could do something like that
yeah, this is probagly not worth doing
premature optimization
you still have to process the AST, which is what the parser already does. You'd be MUCH better off copying the parser out of Om Next
and you probably know how I feel about copy-pasted code 🙂
I actually don't; but the fact the omcljs pulls in google closure into my server side feels icky
you'd be better off specifying lein exclusions of the stuff you don't want/need
then as long as you don't load the namespaces that use that stuff in your app, no problem
@tony.ka: alright, one more question for tonight while you're here (perhaps more tomorrow):
well, then you can manage that with your project file.
where in the example code are you registering the api.clj to "localhost/api" rest handler ?
closure only used by compiler
that is built into Untangled Server
what's the function name for starting untangled server? (I have to force everyting to runinsid gae, so I need to take apart / reassemble parts of this)
it is baked in, though you can augment it with a prefix...or use the new server modular support and build your own. You'd also have to reconfigure the networking on the client side
sure, but where in https://github.com/untangled-web/getting-started-video/tree/basic-server/src/server/app is the Untangled Server started?
the two files are < 100 loc together, and I can't see where you're firing up a webserver
in that one, it is in user.clj
in dev source
you'd normally write a main to do deployment startup. In the example, it only has a dev mode.
See the Untangled Template for something that is more set up for deployment.
I don't use GAE...what are the requirements? Can you use an uberjar?
user.clj clarifies things up; will look into the UntangledTemplate too; thanks!
can you run your own server on a port?
it users uberwar; I'm running my own ring server inside gae
ideally, untangled just becoems a route that I can hand to ring
In that case you want the new modular support
@adambros is documenting that, but it already exists. It lets you define the server however you want
can you point me at the github page for "new modular support" ? is it a tag? (I can't find it vai google)
the "easy" server support does the whole ring stack for you
It is just part of the latest version of untangled-server
okay; thanks
just a sec...I'll PM you something
1) https://github.com/untangled-web/untangled-template is a template we "git clone", not a "lein template new ..." right? 2) assuming (1) is true, can we pease put a license on the template, say Public Domain? 🙂
Ah. Yes on (1) and I thought is said MIT
it should
FYI, I just pushed a branch on the cookbook that has an example: 1. That uses the new form support 2. To make a step-by-step survey (wizard) 3. Uses an SQL database for storage and query https://github.com/untangled-web/untangled-cookbook/tree/feature/sql-wizard/recipes/form-wizard
full stack, of course
license done
Today's a Mathew 7:7 day 🙂
does that make me god ? 😜
pretty sure God would not have forgotten to add the MIT license
make-untangled-server is simpler than I thought
most of Untangled is 😉
it gets passed a (make-web-server), so if I just "invert that", I should be able to "push untagled server into ring" rather than "untangled-server starts it's own webserver"
yep. that's the idea of the new support: make it easy to just plug into Ring
untangled/server/impl/components/handler.clj is most of where "the plubming" happens, with the /api path
our first draft was "get up quick n easy". Second draft: flexible
I'm turning into a pumpkin. happy server coding. 💤
thanks for all your answers today; good night;
========== I must be doing something terribly wrong. After going from "pure clojure.jar" to "untangled.jar + om.jar", my GAE deploy time went from < 30 seconds to 9-minutes 18 seconds.
Hi. Is there any difference between template-workspace
& template
repo ?
I'm only aware of the untangled-tempalte repo, which worked fine for me.
@qqq cool. All working well with untangled client/server on appengine ? 🙂
I got it working locally with the template. I don't have it working locally with the dev_appserver.sh
So by "working" I mean it's using the webserver from untangled, not the one from gae.
🙂 cool. Pretty much convinced that untangled is the way to go. Trying now to get it all setup with appengine & datastore.
wait wait; you're trying to set this up on appengine & datastore too?
We should pool our efforts.
Just to clarify, your goal is: client side = cljs / untangled server side = clj / untangled / running on Google App Engine, actual data store of the [kw id] value triples via datastore correct?
@qqq yep 🙂
also server side rendering on appengine 🙂 for fast initial page loads
@tony.kay: I'm having a trouble seeing Om.Next ends and UnTangled starts. Do you have a talk comparing/contrasting the two?
Untangled is on top of Om Next. It provides the bits you need to glue it all together.
with all due respect, that's MBA speak, not tech speak 🙂
0-content answer
there's not a doc/talk somewhere contrasting the two?
I'm not sure how to answer it. Om Next is most of what you're interacting with. Untangled adds in a number of things: InitialAppState is Untangled
defui, IQuery, Ident are ON
I guess om/... is omnext, and uc/.... is untangeld
right
database format is the default Om Next format. I'm not sure how teasing apart each thing is necessarily helpful
If I'm asking weird questions, it's most likely because I have an incorrect mental model.
Think of Untangled as the Batteries Included version of Om Next
and in some ways, it is more focused and opinionated. This is a trade-off: the focus/opinion lets us solve lots of things for you that you would otherwise spend weeks polishing yourself
it also reduces some of the sheer learning curve by reducing the number of knobs you have to deal with down to the ones most people care about.
The model Om Next has you deal with is one where you build "parser emitters" to do basically everything from retrieve data locally to making decisions about remote communication. It's very flexible, but you'll end up needing to make lots and lots of decisions about the "how". For example, how do you lazy load something? You have to think through state manipualations and parser bits and pieces. Untangled solves those problems for you and gives you tools (like the data-fetch namespace) to handle those cases without having to think about the details.
My opinion (having worked through building all of this) is that all of that "glue" on top of Om next you'd have to build can takes man-months of effort and head-scratching.
at least to get finished and polished
hmm, for purely educational purposes, I should probably build a few apps without untangled just to see what om/next is missing
otherwise, it's hard to see what untanlged is offering
Try building one
you're right, I should probably make some kind of video showing the guts so you can see what you're getting. Mostly, it is glue around the data model and networking.
well, and the i18n, and the support viewer, etc. But most of those things are very small.
oh no, I'm not in anyway complaining about the untangled documentation
just for personal learning, I like to break everything into small pieces, understand them, then put them back together
You should watch my whiteboard talk https://www.youtube.com/watch?v=IlNrmKYA7Ig
It covers stock Om Next
the one nice thing about taking apart software vs taking about TVs is taht if you can't put it back together, you just to git clone again 🙂
Note all the stuff I end up talking about the reconciler, parsers, remote parsing, etc. Untangled eliminates having to deal with all of that.
You never have to write "read functions". You never have to worry about "remote read decisions" at a parser level. Then there's the merge story, tempid remapping,etc.
My apologies to whoever I've been talking with about modular server support. It is not actually in a release yet 😊
I just realized that we did an internal release on that feature, and didn't ever release it. So, will do so now
I'll also add a branch to the template that shows a simple use of it
@tony.kay: between this and not uploading the LICENSE to untangled-template, I think you should step down 🙂
oh, ok. I'll go skiing instead...