little bit mount
-rusty. Is this normal?
ep-cloud.system> (mount/start)
{:started ["#'ep-cloud.config/config" "#'ep-cloud.logging/parent-logger"]}
ep-cloud.system> (mount/stop)
{:stopped []}
No state is stoppedI also see the following in the repl:
Lumo socket REPL listening at localhost:5044.
cljs.user=> [5547.553s] [mount] >> starting.. #'ep-cloud.logging/logger (namespace was recompiled)
[5547.915s] [mount] >> starting.. #'ep-cloud.logging$macros/logger (namespace was recompiled)
this usually happens when there are no :stop
functions
i.e.
(defstate config :start (load-config))
Oh, you know, I actually wanted to assign nil
on stop
But probably I am not doing it right :simple_smile:
I need to wrap it in a fn I guess
it will still be "NotStartedState" after it is stopped though
Well, my state is a map so I want to make sure that on stop it won't be filled anymore
a question and a comment (it might make sense in node
world, but I'll still ask):
* why do you need a state which is just a map?
* after the state is stopped (given that you have a :stop
function), mount will no longer be referencing this state (map in your case), unless there are other references to this map outside of "this var" it will be garbage collected
The classic config case is a map as well..that is my use case basically it is a map created at start time
Isn't that a thing :) ?
I am ok with #2
So probably I don't need stop - you are right
yea, I usually don't stop config
: https://github.com/tolitius/hubble/blob/master/src/clj/hubble/env.clj#L30
when I do "reset" it just reloads, but in some cases (in case of lumo) reset won't work, so you can have :stop
function that could be anything to "make it stop"
(i.e. if :stop
function is there, mount will know that this component needs to be stopped, so next time you are going to call start, it will reload the config )
(i.e. what I mean by reset
is a tools.namespace thingy that refreshes vars in dev)
Oh that's the missing piece, thank you!
First time I am trying this in lumo for real as you can see :simple_smile:
I mean in a real app
that's really exciting, once you are done 🙂 I would really appreciate a blog post or something so we all can learn
Kk will try my best 😺 you have done a pretty good job so not many differences. I guess the only thing is that I need to use @
for the states
Maybe I will discover more things moving forward ;)
yea, I actually like @
: )
Me too, it makes more sense, akin to atom deref
yep