Changing top-level visibility before ns form breaks derived value computation on page refresh in a confusing way when also no-cache is involved (clerk version 0.17.1102):
{:nextjournal.clerk/visibility {:code :hide :result :hide}}
(ns repro)
Eventually I re-read docs and discovered the proper way is:
(ns repro
{:nextjournal.clerk/visibility {:code :hide :result :hide}})
However, I would be useful if the first way either worked the same or gave an error instead of being silently wrong.Full repro code:
{:nextjournal.clerk/visibility {:code :hide :result :hide}}
(ns repro)
(defn square [x]
(* x x))
{:nextjournal.clerk/visibility {:code :show :result :show}}
;; Simulating impurity (in practice reading data from a file on disk).
^{:nextjournal.clerk/no-cache true}
(def x (rand-int 10))
x
(square x)Results in inconsistent values like:
Would you like me to open an issue?
hi @kloud, yes please, an issue would be great
pretty busy with client work atm though so I can’t promise I’ll get to it soon
thanks Martin, no worries. This is technically a user error, it might be an improvement in case other people stumble upon it. Opened https://github.com/nextjournal/clerk/issues/742