Fork me on GitHub
#biff
<
2023-09-05
>
Martynas Maciulevičius08:09:26

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?

Jacob O'Bryant17:09:10

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.

Martynas Maciulevičius18:09:40

> 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.

Jacob O'Bryant18:09:24

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.

Martynas Maciulevičius18:09:11

I was able to fix it by moving my .m2 directory and redownloading.

👍 2
Martynas Maciulevičius18:09:39

Then I removed that directory and moved on. And then vemv actually provided a good way of debugging it.

👍 2
Martynas Maciulevičius19:09:29

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:

Jacob O'Bryant20:09:04

that is a super weird bug ha ha

Martynas Maciulevičius07:09:56

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.

👌 2