clerk

yuhan 2024-03-22T13:40:39.785259Z

There seems to be some issue in the browser when any file which uses clerk/with-viewer throws a runtime error, the entire page turns blank and has to be manually refreshed (instead of showing the usual red error header and stacktrace)

mkvlr 2024-03-23T12:21:28.204579Z

I was wrong about that. It used to be resolved on main until 31326c1f2854e3f23f7cb15bb43cb3f561ad579e but then it broke with 8d2929b99cfa2164f1fbaf54915b9dcaaa6fe46d (which fixed a similar, but slightly different issue).

πŸ‘ 1
yuhan 2024-03-22T13:43:33.277999Z

Minimal repro:

(ns repro
  (:require [nextjournal.clerk :as clerk]
            [nextjournal.clerk.viewer :as clerk.v]))

(clerk/with-viewer clerk.v/string-viewer "glub")

;; (throw (ex-info "whoops" {}))
Start a server with file watchers, and clerk/show! this namespace, then uncomment the last line and save the file

yuhan 2024-03-22T13:47:38.804819Z

This issue occurs without watchers and manually refreshing via clerk/show! , and doesn't seem to depend on the type of exception being thrown (eg. (inc nil) ). The browser console reports a whole bunch of TypeErrors from what appears to be minified React code:

TypeError: b is null       react-dom.production.min.js:183:23
    oy Immutable
    tna component.cljs:423
    Hna template.cljs:128
    Ina template.cljs:131
    Qna template.cljs:234
    qg formatting.cljs:162
    $x clojure_mode.cljs:53
    pna component.cljs:317
    qna component.cljs:364
    rna component.cljs:394
    aw util.cljs:234
    Wla ratom.cljs:337
    rna component.cljs:392
    c component.cljs:410
    React 6
    l scheduler.production.min.js:12
    Y scheduler.production.min.js:14
    93 scheduler.production.min.js:12
    zl core.cljs:11933
    95 scheduler.production.min.js:20
    zl core.cljs:11933
    96 React
    zl core.cljs:11933
    98 React
    zl core.cljs:11933
    99 React
    zl core.cljs:11933
    Al core.cljs:12115
     parser.cljc:321

yuhan 2024-03-22T13:52:01.038429Z

This appears to be triggered by a top-level clerk/with-viewer / with-viewers anywhere within the file, regardless of the arguments it is given. I could open an issue on Github if necessary , couldn't find anything similar reported elsewhere πŸ‘€

πŸ™ 1
2024-03-22T13:52:41.206269Z

Would you please file a Github issue for this with the same info as above, plus the OS and browser versions you’re using?

πŸ‘Œ 1
yuhan 2024-03-22T13:53:06.219209Z

will do, thanks!

πŸ™ 1
mkvlr 2024-03-22T14:25:20.129539Z

I answered, pretty sure it’s resolved on main

πŸŽ‰ 1