This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-09-05
Channels
- # announcements (2)
- # babashka (19)
- # beginners (14)
- # biff (10)
- # calva (23)
- # clojure (49)
- # clojure-europe (15)
- # clojure-nl (3)
- # clojure-norway (25)
- # clojure-seattle (1)
- # clojure-uk (4)
- # clojurescript (7)
- # data-science (6)
- # datahike (3)
- # datomic (1)
- # emacs (13)
- # events (2)
- # fulcro (3)
- # graalvm (13)
- # hyperfiddle (32)
- # leiningen (4)
- # lsp (38)
- # malli (1)
- # missionary (34)
- # nbb (28)
- # off-topic (42)
- # other-languages (5)
- # portal (8)
- # practicalli (1)
- # re-frame (3)
- # releases (1)
- # ring (7)
- # shadow-cljs (13)
- # sql (3)
I don't understand how the reload works with biff. Previously it was reloading the namespaces by itself but yesterday it started to misbehave and today it doesn't do that at all. Am I doing something wrong? I just save the file. I have some data in top-level vars and they should be reloaded when the file is saved. This has worked in the past. I think I didn't change anything :thinking_face: Edit: I refactored the router to get the references to routes from a function. Maybe this is the problem. Edit2: Something is broken. I created a new biff project -- no updates on page reload. I upgraded my system and restarted -- nothing. I can't even reload the things via REPL, the page just doesn't update at all. How do I debug this?
It turns out it was this thing: https://clojurians.slack.com/archives/C03S1KBA2/p1693908172883489
interesting--so you had some custom data readers being defined somewhere?
For future reference, about Biff's reload functionality:
Biff uses the https://github.com/nextjournal/beholder library to call an https://github.com/jacobobryant/biff/blob/d8c83c4cc25123b67e14751ff5d19e6b24f7317c/example/src/com/example.clj#L55 whenever a file is saved. By default, that on-save function includes a call to https://github.com/jacobobryant/biff/blob/d8c83c4cc25123b67e14751ff5d19e6b24f7317c/src/com/biffweb.clj#L201, which in turn https://github.com/jacobobryant/biff/blob/master/src/com/biffweb/impl/util/reload.clj to evaluate any files that have changed and all files which depend on them. It should give the same results as using your editor to evaluate all the files/buffers. e.g. if you have some vars that aren't getting updated, I'd start by just evaluating the file they're in with your editor and then see if that works/if you get any errors. You can also call biff/eval-files!
from your editor, though note that it'll only pick up changes in files that have been saved.
> so you had some custom data readers being defined somewhere? I didn't define any. I didn't have any. I used a reader for something else in one other project but that was a very long time ago. And this shouldn't happen.
so were you able to fix the issue or is it still unresolved? I'm a little fuzzy on the details reading through that thread.
Then I removed that directory and moved on. And then vemv
actually provided a good way of debugging it.
The interesting part is that the issue first partially appeared yesterday when the reloading mechanism stopped reloading reliably.
For instance it would reload every 2 minutes or something.
But if I edit hiccup then it would sometimes reload immediately... but then again wouldn't reload anything again.
I thought I messed something up with symbol references and I was restarting the dev server once in a while.
The interesting thing is that sometimes the update of UI still actually updated.
So I thought that it was really my mistake.
And today I thought that I could try to run the (reload)
function that is provided in the top namespace of the example project.
I ran it and then everything has hit the fan. My tests (they're located in src
directory) started to crash on #inst
symbols and I refactored them away. But then I had #inst
which was harder to refactor.
So now my clojure environment in me laptop was non-working.
Then I asked a question in slack and later I tried it on a different project that uses tools.deps. It was the same problem.
BUT Leiningen-based projects worked 😄
:man-shrugging:
that is a super weird bug ha ha
I now think that what could've happened was that the reader functions were loaded in the wrong order. It could've been a classpath bug where the dependencies were ordered in a different way than usual.