Closed yuhan0 closed 2 months ago
I believe we fixed this in 8d2929b99cfa2164f1fbaf54915b9dcaaa6fe46d. Can you try the latest main
at cbb19fd8f1a9b3b01c9ccb0d43c6dbb4571f3829 and confirm this? Should cut a new release soon.
I was able to reproduce on the latest main:
$ clj -Sdeps '{:deps {io.github.nextjournal/clerk {:git/url "https://github.com/nextjournal/clerk.git" :git/sha "cbb19fd8f1a9b3b01c9ccb0d43c6dbb4571f3829"}}}'
Clojure 1.11.2
user=> (require '[nextjournal.clerk :as clerk])
nil
user=> (clerk/serve! {})
Clerk webserver started on http://localhost:7777 ...
{}
user=> (clerk/show! "src/repro.clj")
Clerk evaluated 'src/repro.clj' in 82.061208ms.
nil
< uncomment the exception-throwing form >
user=> (clerk/show! "src/repro.clj")
Execution error (ExceptionInfo) at nextjournal.clerk.eval/eval+cache! (eval.clj:157).
Execution error (ExceptionInfo) at repro/eval18722 (repro.clj:8).
whoops
user=>
< browser page turns blank >
I made sure to clear the cache (by deleting the .clerk
dir) and restarted the browser / opened the URL in a private window.
Indeed I can reproduce the problem as well. Will look into it. Thanks for the detailed report!
Turns out it was actually the commit I thought fixed it that broke it: 8d2929b99cfa2164f1fbaf54915b9dcaaa6fe46d. It will works with its parent 31326c1f2854e3f23f7cb15bb43cb3f561ad579e.
Looking at this and trying to go at the source of the problem. Apparently we're not able to display values produced by code like:
;; # 🐞Debug
(ns scratch.debug
{:nextjournal.clerk/visibility {:code :hide}}
(:require [nextjournal.clerk :as clerk]
[nextjournal.clerk.viewer :as viewer]))
{:nextjournal/value (clerk/with-viewer viewer/string-viewer "hello")}
the above gives:
Such a map is present on the ex-data of exceptions thrown during clerk/show!
(ex-data -> :doc -> :blob->result) but unlike the result viewer, the piece of ui that renders eval exceptions doesn't have an error-boundary upstream of the inspect-presented
, and hence the blank screen
Still need to understand why the map in the example is not renderable.
Minimal repro:
Start a deps.edn project:
Start a repl and Clerk server, then
show!
the followingsrc/repro.clj
fileVerify the page at
http://localhost:7777/src/repro
is displaying correctly, then uncomment the last line and re-evaluateclerk/show!
Expected outcome:
The error and stacktrace are displayed in red in the browser, which automatically hot-reloads once the exception-throwing expression is resolved (by commenting it out and evaluating
clerk/show!
)Actual:
The browser page turns blank and has to be manually refreshed.
Additional details:
macOS 14.3.1 Clojure 1.11.2 Reproduced on both Firefox (version 123.0.1) and Chrome (Version 104.0.5061.0)
On Firefox, the console prints a series of stack traces from some sort of minified React code:
The issue appears to happen whenever the file contains a call to
clerk/with-viewer
/clerk/with-viewers
, removing it causes the thrown exception to be displayed in the browser GUI.Tested with eg.
(clerk/with-viewers clerk/default-viewers 123)