Fork me on GitHub

Any tips on how to hack on portal? What's your dev set-up like?


To get started, there is a After are installed, it should be as easy as bb dev . For the most part, Portal is a web app so any experience with that should be useful. I used emacs + lsp + inf-clojure but, you should be able to hack on portal any setup.

🙌 1

So, I also use emacs+lsp, when I jack in I get:

error in process sentinel: Could not start nREPL server: WARNING: Specified aliases are undeclared and are not being used: [:dev-cljs]
WARNING: Use of :main-opts with -A is deprecated. Use -M instead.
Execution error (FileNotFoundException) at nrepl.cmdline/require-and-resolve (cmdline.clj:201).
Could not locate shadow/cljs/devtools/server/nrepl__init.class, shadow/cljs/devtools/server/nrepl.clj or shadow/cljs/devtools/server/nrepl.cljc on classpath.

Full report at:


I forgot the docs mention cider-jack-in facepalm. I was having issues with the .dir-locals so I stopped using it a while back. Now, I start the project with bb dev and connect to the repl from emacs. Sorry for the confusion.

🙌 1

No worries. So, let's say, after starting bb dev I open the src/portal/api.cljc file, then I do cider-connect-clj&cljs which finds automatically portal:37589, then I choose shadow as the cljs repl type, and then I'm presented with a choice of shadow-cljs builds: :client, :pwa, :vs-code, :node, browser-repl and node-repl. Questions: 1. How do they differ and which one should I use? 2. How is it possible that one repl can do both clj and cljs (I'm used to developing apps in cljs only but I'm confused by the two aspects)


For example, even after choosing I think :client, if I change the definition of portal/ui/state/select-parent I get that there's no cljs repl available


The client is the main one you want for connecting to the UI. The problem you are probably running into is needing to open the dev version of the UI, which can be done like

🙌 1

Yes, that was indeed the problem, thanks! For reference, what thought process should I have used to discover that myself?


I think you can find a bunch of useful dev stuff in the user ns


I was looking into using dev/portal/setup.cljs . If I open that file, cider-connect-clj&cljs to the nrepl server opened by bb dev, I still get No available JS runtime. How should I invoke, eg, (def portal (p/open {:mode :dev :value state/state})). Why does this happen?


You first need to do (portal.api/open {:mode :dev}) from the jvm which will open the Portal UI (a JS runtime) then your shadow repl should have an environment to evaluate cljs, and then you can run (def portal (portal.web/open {:mode :dev :value state/state})) and other expressions to poke around the client runtime=

🙌 1

Right, I tried that before, but I get :repl/exception, and then in my repl:

Execution error (TypeError) at (<cljs repl>:1).
Cannot set properties of null (setting 'onunload')


So to use portal.web you need to enable popups


Although I have a feeling that might be of interest to you 🎉


Indeed 😂 🎉 🎉 🎉