Fork me on GitHub
#untangled
<
2016-07-06
>
adambrosio01:07:05

ok after talking with tony i’ll be putting it off until they are formally released

tony.kay15:07:44

Just FYI. My current job just got kinda crazy (acting as interim CTO). So, my involvement here will be somewhat reduced for a while.

tony.kay15:07:29

The other team members will be around to answer questions/help with bugs. The more you can narrow down any issues you find the better.

jasonjckn18:07:57

iCTO 🙂 as steve jobs would say

curtosis22:07:00

hmmm... (reset) doesn't seem to be actually reloading server code. Any clues where to look?

jasonjckn22:07:13

hm, works for me

jasonjckn22:07:18

the code is in user.clj

jasonjckn22:07:31

it's just using stuart sierra components reset

curtosis22:07:45

(refresh) (go) also doesn't reload... I'm having to shut down the repl and restart it to see server code changes.

jasonjckn22:07:09

try untangled-todomvc vanilla code base

jasonjckn22:07:11

should work there

curtosis22:07:40

urgh. I don't have that set up in IntelliJ atm to make sure everything's the same. but i guess it's the thing to do.

curtosis22:07:04

I'm even seeing the correct list of namespaces in the :reloading message from (reset)

curtosis22:07:48

and yet I'm still getting old versions of read methods getting called.

jasonjckn22:07:52

i began my codebase starting with untangled-todomvc as the base, haven't had issues

jasonjckn22:07:20

(not sure why that's happening)

curtosis22:07:45

have you rolled the untangled versions forward? (todomvc is back on 0.4.9/0.4.8)

curtosis22:07:56

(which shouldn't affect this, just curious)

curtosis22:07:21

I think I started my codebase the same way, fwiw

jasonjckn22:07:31

my untangled-client deps? yes

jasonjckn22:07:40

[navis/untangled-client "0.5.4-20160620.191104-1"

jasonjckn22:07:47

[org.omcljs/om "1.0.0-alpha36"]

jasonjckn22:07:59

[navis/untangled-spec "0.3.8" :scope "test"]

curtosis22:07:55

I'm on client 0.5.3, server 0.6.0, om 1.0.0-alpha37.

jasonjckn22:07:48

cool, i'll upgrade my om version

jasonjckn22:07:17

[navis/untangled-server "0.4.8" :exclusions [io.aviso/pretty org.clojure/clojurescript]]

curtosis22:07:21

it's so crazy... I have a map my basic test query returns via an api-read multimethod. I change a number in the map, (reset) the server, reload the client page, and I still get the old number in the response.

jasonjckn23:07:07

i could give you myc ode... but it's just the same as todomvc, not sure

curtosis23:07:28

like, there's no reason this shouldn't work.

jasonjckn23:07:38

i ended up changing it actually , but not because of any issues iwth the old code

jasonjckn23:07:49

(defonce system nil)
(defn stop []
  (alter-var-root #'system
                  (fn [s] (when s (component/stop s) nil))))

(defn start []
  (alter-var-root #'system
                  (fn [s]
                    (if s s
                        (-> (system/make-system) (component/start))))))

(defn reset []
  (stop)
  (refresh :after 'user/start))

curtosis23:07:58

(modulo my own stupidity, obv)

tony.kay23:07:27

@curtosis: did you write everything you've added to be a component so that your'e getting a full reload?

curtosis23:07:32

@tony.kay: Vacuously yes. 🙂 As in, all I've added is an api-read multimethod into the existing component. And in fact, when I do a (reset) I see :reloading (my-server.api my-server.system) if I've changed the file; :reloading () if I haven't.

tony.kay23:07:34

remember that multimethods are entries in a map

tony.kay23:07:52

so, if you change the dispatch symbol, perhaps there's an old entry

tony.kay23:07:02

but if you've restarted repl that wouldn't be the case

tony.kay23:07:16

I would expect tools namespace to be clearing that, so don't know.

curtosis23:07:23

yeah.... it's kind of baffling.

curtosis23:07:01

my user.clj is basically straight from todomvc:

(defn stop "Stop the running web server. Is a no-op if the server is already stopped" []
  (when @system
    (swap! system component/stop)
    (reset! system nil)))

(defn go "Load the overall web server system and start it." []
  (init)
  (start))

(defn reset
  "Stop the web server, refresh all namespace source code from disk, then restart the web server."
  []
  (stop)
  (refresh :after 'user/go))

tony.kay23:07:18

yeah, what is the body of the multimethod in question?

curtosis23:07:02

(defmethod api-read :sources-list [e k p]
  (timbre/info "query: " (op/ast->expr (:ast e)))
  {:value table})

tony.kay23:07:05

and have you mucked with the refresh dirs? Perhaps there is stuff that should be refreshed that isn't, and some path of closure is hitting you

tony.kay23:07:21

what is table?

tony.kay23:07:40

if you change the info logging stmt, is IT reflected?

curtosis23:07:43

hmmm... not to my recollection, but I should check the refresh dirs

curtosis23:07:00

no, in fact that's my latest change - changing the logging. 😛

curtosis23:07:06

table is just a map

curtosis23:07:44

I could wrap it in an atom, but I have another query returning a dereferenced atom and it has the same problem

tony.kay23:07:54

yeah, I;ve not experienced a problem like this. You're manually running a (reset) from the repl, right?

tony.kay23:07:01

And you just said the logging sttmt wasn't changing

tony.kay23:07:07

so, you're obviously not getting reloaded

tony.kay23:07:24

OR you have the same multimethod TWICE in the code, and the second is overwriting the first

curtosis23:07:41

just the one multimethod

tony.kay23:07:42

my cousin grep might help

tony.kay23:07:51

(my initials are awk)

tony.kay23:07:18

about 3 UNIX nerds just got that joke...evidently on another channel

curtosis23:07:04

(set-refresh-dirs "src/server" "specs/server") should pick up everything under src/server, right?

curtosis23:07:12

I did get it indeed.

curtosis23:07:37

briefly pondered making a cgrep = cousin-grep joke.

tony.kay23:07:37

oh...why isn't dev/server in there?

tony.kay23:07:42

there is something in my distant memory that says you want it

tony.kay23:07:48

can't say why

tony.kay23:07:53

cause I don't remember

curtosis23:07:10

hmm... good question. though the code I'm changing isn't under dev/server ... maybe it's to do with the general namespace-swizzling voodoo.

curtosis23:07:14

I'll try that.

tony.kay23:07:41

I seem to remember having problems if I didn't have that...probably something about system closing over stuff

curtosis23:07:03

et voilà. that was it!

curtosis23:07:30

adding a comment to my code now to remember why it's there. 😉

curtosis23:07:02

now back to getting data back into the client side....

curtosis23:07:03

aka learning to get the reconciler to do my work for me....