Fork me on GitHub
#shadow-cljs
<
2017-10-08
>
Jon09:10:08

(ns reel.comp.container
  (:require-macros [respo.macros :refer [defcomp <> div span]])
  (:require [hsl.core :refer [hsl]]
            [respo-ui.style :as ui]
            [respo.core :refer [create-comp]]
            [respo.comp.space :refer [=<]]
            [reel.comp.reel :refer [comp-reel]]
            [reel.comp.todolist :refer [comp-todolist]]))

Jon09:10:36

dependency tree: container.cljs -> reel.cljs -> records.cljs

Jon09:10:03

I thought container.cljs will be reloaded as well when records.cljs changed?

thheller10:10:10

no. only direct dependencies.

thheller10:10:27

no change in records.cljs can affect code in container.cljs, so it doesn’t need to be reloaded

Jon10:10:21

a.cljs

(def a 1)
b.cljs
; imports a

(def b (inc a))
c.cljs
; imports b

(def c (inc b))

Jon10:10:49

how about this?

thheller10:10:51

well yeah, don’t use global state 😛

Jon10:10:00

functions may be more stable..

Jon10:10:48

I ran into a situation that I want to detect if a component and pure function are changed after HMR,

Jon10:10:28

I was doing that by comparing the references. Since they may not change, my code does not work sometimes.

thheller10:10:24

not sure, I would usually recommend to use the :before-load :after-load functions and avoid global state

thheller10:10:06

hmm but even in your example? a.cljs = container.cljs, b=reel, c=records

thheller10:10:18

changing c does not affect b or a

Jon10:10:46

c is the container, and a is changing

thheller10:10:12

ah yeah, I had the wrong order in my mind 🙂

Jon10:10:53

I knew comparing the references is too tricky. I was trying to reduce some unnecessary recalculations.

mhuebert20:10:36

Alrighty. I’ve updated http://www.github.com/mhuebert/shadow-eval to 2.0.8, added a :bootstrap build. It compiles, but the last example that I had working in 2.0.7 now throws an error when I try to use the macros that I’ve required/referred in the namespace: Cannot read property 'findInternedVar' of null at line 4 \", :data {:file nil, :line 4, :column 1, :tag :cljs/analysis-error}, :cause #object[TypeError TypeError: Cannot read property 'findInternedVar' of null] Other expressions, like circle and the for macro, work as expected. Update: if I (require-macros '[cells.cell]), then the other expressions work. Maybe the :load-on-init namespaces aren’t loading their dependencies? (or macro dependencies?) I have shadow-eval.user in :load-on-init.

mhuebert20:10:52

I also made another attempt at a bootstrap build w/ maria, and got stuck on The required namespace "cljs.env.macros" is not available, it was required by "cljs/js$macros.cljc". error in compile. I have tried adding cljs.js and cljs.js$macros and cljs.env.macros and cljs.env.macros$macros to an :exclude option in the build, didn’t seem to make a difference. I can also replicate this in shadow-eval.