This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2015-12-22
Channels
- # admin-announcements (25)
- # beginners (60)
- # boot (277)
- # cider (5)
- # cljs-dev (3)
- # cljsrn (2)
- # clojure (82)
- # clojure-art (15)
- # clojure-berlin (2)
- # clojure-boston (1)
- # clojure-italy (40)
- # clojure-russia (118)
- # clojurebridge (1)
- # clojurecup (1)
- # clojurescript (82)
- # component (3)
- # cursive (31)
- # datavis (9)
- # datomic (39)
- # editors (1)
- # editors-rus (9)
- # emacs (15)
- # hoplon (50)
- # ldnclj (2)
- # leiningen (4)
- # off-topic (9)
- # om (123)
- # re-frame (28)
- # reagent (7)
- # vim (1)
- # yada (3)
there’s always s/pred
@sveri: or (s/maybe s/Str)
regarding schema - how do you guys organize your schema code? do you put your schemas next to the place you create data or you have a separate namespaces for schemas?
@andrut: both, depending on usage. i've got some schemas which are shared between cljs ui and clj backend which are in their own namespaces, and others which live near the code which uses them
I’ve got quite a lot of same data structures that are being passed around the whole application; maybe I should put it into records and use this as schemas or should I leave it as plain maps and define schemas somewhere… but thanks for your answer, @mccraigmccraig
Hi, I lately switched from component to mount. Now I see a behavior I find strange, but I am not sure if that did happen before with component too. So, I have several things defined with defstate. I use Cursive and whenever I adapt a function in a namespace and reload that changed function into the REPL the component, that that code belongs to, is stopped and I have to start it manually again. This is somewhat unexpected as most of my components stop after changing some code.
@jonpither: post in #C0F0V8DT5 & you’re likely to find some help.
that sucks. I just started using mount on a new project. Would suck if I don’t get code reload.
@roberto Don't get me wrong, it does reload the code. But, what it does, is, to stop some components
OTOH I have several complex with a lot of dependencies thrown together, the cause might also be a different library
So, not sure if it is really mounts fault or someone elses, I just think the tendency is there
I also searched github for how others used it and did not really find any repos doing so. That means it is in kind of early adopters state and I think there are more bugs around that are not found yet.
FYI i created a channel #C0GQAAKA9 for discussions related to component-based workflow
@settinghead: thanks, didn't know that
@sveri: when you reload code which does not have any states defined, it reloads as you would expect.
when you reload with states defined and started, new states are created with, potentially, new changes introduced before recompilation. hence before creating these new states, mount cleans up any resources old states might be still using by calling their :stop
functions.
currently (starting from 0.1.7
) mount will tell you when it happens: https://github.com/tolitius/mount/issues/22#issuecomment-164834038
if you are using the reloaded workflow, you can simply (reset)
if this happens, and/or you can do (mount/start #'this.state)
.
I understand that it is an extra step, you can open an issue on the github and we can definitely discuss whether mount should just start these new states after a namespace was recompiled, or ignore certain states on recompile if they are not occupying any resources, etc.. so things are more transparent
@sveri: another thing to consider is how to organize the code with "states". I tend to agree with @yogthos that it is best to > "keep the code that interacts with external resources at the edges of the application. The core business logic should be pure and testable, while anything that deals with side effects and external resources should be pushed to a thin layer around it" source: http://yogthos.net/posts/2015-12-05-LuminusComponents.html in which case reloading the code with states would not be often at all. I would still like to discuss it though, since I am interested in the useful behavior, so feel free to open a github issue