clerk

teodorlu 2024-12-17T11:38:08.343879Z

Morning 🙂 Is there a way to ask Clerk to recompute the notebook on atom changes, but without syncing the atom state to the frontend? I'm asking because the data I'm trying to put in my atom contains reader tags that aren't installed in the Clerk Clojurescript environment.

teodorlu 2024-12-17T11:39:30.330779Z

When I reset! an instant into the synced atom, I get this exception:

teodorlu 2024-12-17T11:42:06.968359Z

When I remove ::clerk/sync true, all is peachy.

teodorlu 2024-12-17T11:59:55.706419Z

Calling nextjournal.clerk/recompute on each atom change appears to work reasonably as a workaround. Changes reflected in values that deref the atom update immediately, though I don't see any changes in the original defonced atom.

(do (defonce !state (atom nil))
    @!state)

^{::clerk/visibility {:code :hide :result :hide}}
(add-watch !state ::recompute (fn [_ _ _ _] (clerk/recompute!)))

(comment
  (reset! !state (random-uuid))
  )

Nguyen Hoai Nam 2024-12-18T01:51:05.746199Z

I’m thinking of Clerk’s eval-cljs and ClojureScript’s cljs.reader/add-data-readers off the top of my head, though I’m sure there has to be a more elegant way.

👍 1