Fork me on GitHub
#scittle
<
2022-12-05
>
genRaiy16:12:46

Something I am observing in the https://github.com/raymcdermott/aoc22 ... the atoms do not seem to be respected per namespace .... for example each ns has this: (def part-1-visible? (r/atom false)) and the buttons toggle its value. But if its set in one ns, it's set in them all. Is that expected or am I holding it wrong?

borkdude17:12:30

@raymcdermott I debugged this locally and added to the home-screen:

(defn home-page
  []
  (let [solution-data (edn/read-string @solutions)]
    [:div.m-3.p-3.border-0
     [days solution-data]
     [:div
      (str @day1/part-1-visible?)
      (str @day3/part-1-visible?)]]))
You can quite clearly see that the values can be different at different times, so maybe there's something else going wrong. As you're having quite a lot of state scattered around, it's difficult to keep track of things. It's usually good to put more state together in one atom, e.g. for the entire app. Scittle also has a re-frame plugin which I think is quite good for this multi-screen type of thing

genRaiy17:12:49

ok - I'll make each of the atoms named by the ns

genRaiy17:12:03

reframe will be a decent size re-write so :man-shrugging::skin-tone-3:

borkdude17:12:18

are you saying you have something better to do than writing Clojure?

genRaiy17:12:36

no but I have to catch up with days 4 and 5 🙂

borkdude17:12:47

oh it's already that late?

borkdude17:12:14

good luck :-D

genRaiy17:12:30

I'm on holiday next week so I can catch up properly then 🙂

genRaiy17:12:29

what I find odd is that there is an atom called data that is not polluted across the namespaces ... must be something else

borkdude17:12:18

as I've shown before, it is not a namespace cross-pollution problem, since the atoms can be set independently

genRaiy17:12:58

yeah I think there is a function that is being re-defined ... gonna put that in the helper

genRaiy17:12:20

not that ... it's that a bunch of the divs have the same targetID FFS 🙂

😆 1