Fork me on GitHub
#cursive
<
2024-01-20
>
cfleming05:01:36

Cursive 1.13.2-eap2 is out. It fixes the deps TRANSACTION_START issue, and another related one I found while debugging that one. https://groups.google.com/g/cursive/c/6PYUB4fUBxg/m/sG2YBArZAAAJ

p-himik21:01:24

Is there a way to prevent a particular vector in the :require form from being sorted along with the rest? I need a particular ns to stay at the top.

p-himik21:01:49

Ah, seems that my particular use case can be solved by moving that ns from that :require and into :entries in shadow-cljs.edn.

cfleming08:01:32

I’m curious, what would the use case for that be?

p-himik10:01:24

To make sure that some particular code runs before anything else is loaded. In this case, it's Sentry's config, so it catches all possible warnings/errors/exceptions and reports them. Some namespaces have side-effecting code at the top level (re-frame event/sub handlers, kee-frame controllers, etc.) that can potentially throw or show a warning.

onetom19:01:43

just put the side-effecting parts into a function and boot your app explicitly by calling those initialization functions in the desired order. it's too magical to depend on the order inside the ns form, which this example highlights too.

p-himik19:01:09

Not too magical when the whole app uses re-frame. I'd have to have as many functions as there are namespaces, and then painstakingly repeat the process of correctly calling one thing from another when the :require form already does that for me, with the exception of that one instance.

p-himik19:01:56

And to expand my other message - it's not about just side-effecting code. E.g. (.-x obj) is not expected to do anything (side-effecting getters aside). And yet it'll throw if obj is null or undefined. I want to catch such errors as well, when they happen at def time.

p-himik19:01:42

But as I said, I won't rely on the order of :require now that I've learned about how :entries in shadow-cljs.edn can help here.