Fork me on GitHub

hey people, sorry for total newb question, and although I'm experienced with Clojure, I'm just starting for first time with CLJS/Figwheel/Om/Untangled...And probably this isn't Untangled-related, but since I dunno, I ask here...Anyway, I started untangled todomvc app, and yesterday the app loaded fine in Chrome, but today, it doesn't for some reason, BUT in my Firefox it works!?!?!... And the only thing that Chrome shows in console is sometimes this "not found" favicon error:

[  0.326s] [goog.module.ModuleManager] Module loaded: en-US
console.js:203  [  0.338s] [goog.module.ModuleManager] Module loaded: es-MX
utils.cljs:38 Figwheel: trying to open cljs reload socket
utils.cljs:38 Figwheel: socket connection established
 Failed to load resource: the server responded with a status of 404 (Not Found)
But even this error dissapears if I refresh the empty page. So anyway, problem manifests itself that nothing shows up, and no in console. It just says that modules are loaded, and it connects to figwheel and that is, as shown above. But nothing shows on page!


I'm losing my head with this, so can someone share some light what is wrong with Chrome suddenly, and I really don't remember I changed anything with my setup, I just try going as usual to :


I'm 100% sure I didn't change anysthing in project, because my git shows no files changed. Really puzzling...


when I type:

(js/alert "Mama")
The alert pops up OK


in figwheel REPL I mean


And just to clarify, <div id="app"> is empty in Chrome, whereas it is populated in Firefox, thus page naturally empty in Chrome 😞


@vmarcinko: have you tried chrome incognito mode?


Just in case it’s pluggin related.


@vmarcinko: lein clean lein deps, then go again.


@currentoor: @cjmurphy Thanx guy, will try out your suggestions.... But overall, does CLJS development has more nuisances like this compared to CLJ ?


Yes but that's the cost of having 'live coding'.


Sometimes I just build from the cmd line the usual way lein cljsbuild once just to be grounded again.


@currentoor: OMG! It really works in incognito mode!!! But anyway, I even suspected that some plugin may be messing things up, so I removed react dev tools, and clojruescript dev tools, but still problem persisted in normal mode


If I really think there's a problem I manually delete the javascript - perhaps my poor setup as clean ought to be doing that.


yeah, i tried couple of times deleting output (compiled JS) dir


That's interesting that incognito way - good debugging aid. What does it mean if it works in incognito mode?


@currentoor: Do you suspect that this line is crucial :

Installing cljs-devtools: custom-formatters dirac sanity-hints


Means no web cache - so solution is to clean out your cache.


Then s/work in normal mode too??


it doesn't show up in normal mode, just in incognito where it works (and also in firefox where it works also)


But nothing shows up in normal mode, b/c of the cache problem right? Not seeing dirac stuff just a symptom.


yeah, nothing shows up in normal mode... To be honest, such a big noob with web so I dunno what you mean with web cache here? I should clear the local cache in my browser?


'Clear browsing data' under tools from hamburger


'more tools'.


Hamburger consists of top bun, meat, bottom bun, so is three horiz lines at top RH corner.


@cjmurphy: Thanx , now it works


yeah, i wondered what hamburger means, but I recall where cache clearing is, so I saw the icon, and guessed what you mean simple_smile


BTW, what you suspect has been the problem after all then?


Cool - I had to look it up once not so long ago too - lots of things about the web world...


I kinda don't like these situations where web cache can mess things up


All I can say is it is rare.


OK, I hope...I just started with CLJS/Untangled yesterday for 1-2 hgours, and it already struck me


But you know there's no transactions - so it is quite possible to stuff things up!


Yes - it strikes at the beginning, then not so much after that. Just how it seems to me! simple_smile


I'm just old school server-side web developer from some years gao, so total newb with JS world


ok, thanx anyway


BTW, wondering, why Untangled doesn't use latest clojrue/clojruescript (1.8.x)?


or it's just like that in project.clj files now?


todomvc, tutorial...


B/c only a few days ago cljs became newest version I guess.


ok, i changed these to newest because I wanted to try out if that was the problem, so at least todomvc works i can see


also with figwheel 0.5.2


When I run the untangled-todomvc app and say mark one of the todo items as complete, then they all get rendered again. That doesn't need to be the case, and in a similar small app I built myself I see only the item that gets checked being re-rendered.


Trouble is I don't know what you need to do to get only one to re-render.


Is the re-rendering logic described anywhere?


@cjmurphy: Look at the check and uncheck function implementation


They are implemented in the parent, which is why you see what you see


The parent being the TodoList component


@vmarcinko: in the chrome developer tool window, choose the networking tab and check “Disable Cache”. If you ever get an error like that again, just open up the dev window and refresh the page. that usually takes care of errors like that. Chrome's and figwheel’s caching systems seem to get out of sync every so often


In general, these are the untangled team’s troubleshooting steps when the build tools aren’t cooperating: 1. Open up the dev tools in your browser and ensure that network caching is disabled. 2. Call (reset-autobuild) from the client repl and (reset) from the server. 3. Stop both the client and server repls, and run lein clean. If using IntelliJ, refresh Leiningen dependencies, otherwise run lein -U deps. Restart both repls.


@cjmurphy @mahinshaw: not actually sure why that mutation is defined in the parent component, based on the implementation of the mutation it could be (probably should be, from a design / re-render perspective) moved to the child. The delete mutation, by contrast, has to be defined in the parent so that the whole list is re-rendered when the delete action is called by the child


@ethangracer: I blame you for that terrible implementation ...


@ethangracer: Yes for sure delete has to go in parent and just changing the item ought to be able to go in the child and affect only that row. Trouble is you will have to put in a follow-on read after mutate key to get it to work. And that's where you can run into difficulties...


one mroe question, not untangled related, but more cljs/figwheel - I can see that web server started via server-side (port 3000) is used to load web artefacts in browser, but figwheel itself starts a web server at port 3449...Is this figwheel port even utilized for something then?


as i said, i'm still total cljs noob...


@cjmurphy: ah ok, I remember now. Honestly I haven’t been able to figure out why a follow-on read is necessary for that function… based on my understanding of Om it shouldn’t be because the child component renders the entire item div. So a transact!on the component should trigger the rerender without a follow-on read.


so, if you have any insight into that I’m all ears


@vmarcinko: port 3449 is the figwheel server that compiles the code and serves it to the browser. port 3000 is the communication port between the served browser code and the server. I don’t know the particulars of how that’s all connected but that’s the difference between them — 3449 is figwheel’s implementation, 3000 is untangled's


The follow on reads seems like a flawed concept to me. Because no matter which key you choose it will be a root key (because all your keys are as joins in the root). And that will cause the whole thing to re-render from the top. So there's no specificity possible. Or I'd like to see a working example...


if you do a follow-on read for :item/complete it shouldn’t rerender from root


The thing is I bet if you put the mutate in the child nothing would happen - so you would then need to put in a follow on read.


but it will re-render every component instance that implements :item/complete, which means all of the todo items


so i guess you’re right, effectively little difference


how does untangled get away with always returning just {:value ...} in read-local, no remotes?


oh, I found it:


Is there anyway to use a different webserver and some additional routes to the untangled system?


@currentoor: I am not sure what you mean by a different web server. But, you can add additional routes when you are leveraging the make-untangled-server. You use the keyword :extra-routes followed by a map.


@darrellesh: Like if I wanted to use http instead of jetty for instance.


Sorry I mean http-kit.


@currentoor: example extra-routes is

{:routes ["" {["/todos/" :id "/info/" [#".*" :email]] :todo-handler
                                  ["/todos"] :todo-list-handler}]
                     :handlers {:todo-handler (fn [req env match] (mut/generate-todo req env match))
                                :todo-list-handler (fn [req env match] (mut/generate-todo-list req env match))}})


@tomjack: you got it, that’s my favorite part of untangled. no need to write any read code on the client!


@currentoor: Not sure about how to switch servers. Haven't looked into that. We have not had the need thus far to do so.


Oh cool you're using bidi.


It's a pretty robust way to reload components on save.


I remember hearing tony.kay saying an aspiring contributor could add reload-on-save for the backend.


I am experimenting with localforage as a remote. I wonder how untangled would want to handle stuff like localforage?


(localforage is a localStorage etc wrapper)


@currentoor: haven’t looked at it to my knowledge. my initial impression is that it has a lot of dependencies, which we’re trying to isolate on our end. we’ve talked about how we don’t want untangled-server to depend on datomic, for example


@currentoor: I have not looked into the danielsz/system. But, it looks interesting.


the reload-on-save is desirable though...


@ethangracer: I can totally see why you'd want that but doesn't this seem like pretty lean dependencies?


oh interesting, all the dependencies I was looking at seem to be dev dependencies. how does the component work in production then?


You have to include that dependency in your app, I believe.


ah ok, that makes sense. it looks like a super helpful library, @tony.kay have you looked at this at all?


I'm an aspiring contributor and I've used this library a few times. So if you guys are interested I could try adding it in this weekend.


Also, we are considering using Untangled at my work, AdStage, since we are building our new app in and Datomic.


But we realize that Untangled is still pretty new so we'd like to contribute, if we use it.


I could start with this to get a feel for your framework.


awesome! we’ll definitely appreciate all the help we can get. I would run the idea past Tony, he has a better idea of where the framework is going design-wise, and he also accepts all the pull requests 😄. we are working toward using untangled in production and so far, so good


So you're not currently using untangled in production?


When do you expect to do so?


hard to pin an exact date on it, in the next several months


the rest of our company is on a different stack so there’s some integration work to do. we started to build untangled since we are using and datomic for new apps as well


@currentoor: talked to tony about the library, we already have the ability to inject components in untangled server and we’re not looking for the kind of code-reload that that danielsz/system implements. what would be ideal is, any time that a server file in the source directory is changed, the (reset) function in dev/user.clj is called. Sounds like having live code reload on the server has caused problems for us in the past


I see, thanks.


I think system also does something similar to the reset function, starts and stops the component tree whenever there is a save. It's not just swapping out clojure vars or anything like that.


That said if you already have the reset function I suppose it makes sense not to bring in a new way of doing things.


By all means, feel free to tinker. If you want to try integrating it and it turns out not to cause any instabilities, I can’t imagine that’d be a problem. Maybe there’s code that could be repurposed to our own (reset).


sounds good!


@tomjack: never used localforage, though I played around a bit with the idea of using localStorage as a remote and decided it would just be easier to use directly in untangled-client


So, for reload on save ( @currentoor ), I really mean calling reset on file change. So a file watcher that calls reset for you. I'm not worried about hot code reload because if you're playing with the thing live Untangled encourages you to have a stateless server (state is stored in Datomic or something) reset is fine.


Something that can be turned on/off as well....e.g. (start-watching)


Ah, I see Ethan answered that...yeah, +1 simple_smile


Also, on production use: We are going to be using it that way. We have 10 developers actively working on software that will be released this year. We're not a date-driven shop, so I cannot tell you when we'll release something, but it will be this year. Since Om is alpha, we cannot really call our code anything but that.


Contribution-wise: Definitely open to contributions. I'm more than happy to Skype with people on code design so we don't waste time (I find that more effective than texting for hours). If it is something simple, then written is fine. If it has any complexity, then white board, camera, and voice are preferred. I have limited time to do that, but definitely some. Others on the team can also participate in that.


At the moment, documentation is at the top of the list. It has enough features that we are not finding it lacking when trying to build things...but it would help to have a cookbook.


I think @ethangracer has started such a thing.