This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2024-03-02
Channels
- # ai (5)
- # announcements (1)
- # babashka (8)
- # beginners (16)
- # clojure (21)
- # clojure-europe (3)
- # clojure-norway (6)
- # clojure-uk (1)
- # datomic (3)
- # events (4)
- # figwheel-main (5)
- # fulcro (10)
- # jobs (1)
- # lsp (26)
- # missionary (5)
- # pedestal (1)
- # polylith (3)
- # portal (28)
- # practicalli (1)
- # reagent (37)
- # reitit (1)
- # scittle (24)
- # tools-deps (7)
Ok so I made a terrible hack to call figwheel from the browser to create a self-hosted REPL, and there's a ~10seconds delay after the first request, feels like a timeout from doing things the wrong way
Using this from cljs, where form is a string from CodeMirror:
(defn send [form ns]
(frepl/respond-to-connection {:op "demo/repl" :form form :ns ns}))
And this monstrosity from clj:
(defn on-repl [{:keys [response]}]
(when (= "demo/repl" (:op response))
(binding [cljs.env/*compiler* (-> @figwheel.main.watching/*watcher* :watches
first second :figwheel.main/watch-info :compiler-env)]
(let [forms (cljs.analyzer.api/forms-seq (StringReader. (:form response)))
f1 (first forms)
mod (when (and (list? f1) (= 'ns (first f1)))
(second f1))
forms (conj (if-not mod forms (next forms)) 'do)
mod (or mod (symbol (or (:ns response) "cljs.user")))]
(cljs.repl/evaluate-form
(fapi/repl-env "dev")
(assoc (cljs.analyzer/empty-env) :ns (cljs.analyzer/get-namespace mod))
"<self repl>"
forms
(#'cljs.repl/wrap-fn forms))))))
It works, surprisingly enough, but client requests are pending as if waiting on a timeout when fired within 10secs of each other
I think the server expects the flow to go from cider-like client -> server -> browser client
, but here it's browser client -> server -> browser client