clerk

2025-02-17T13:18:13.538649Z

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.

2025-02-17T13:18:25.558279Z

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)

2025-02-17T13:19:13.683349Z

Results in inconsistent values like:

2025-02-17T13:20:46.177719Z

Would you like me to open an issue?

mkvlr 2025-02-17T14:19:40.456399Z

hi @kloud, yes please, an issue would be great

mkvlr 2025-02-17T14:20:03.867879Z

pretty busy with client work atm though so I can’t promise I’ll get to it soon

2025-02-17T18:47:41.846409Z

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