re-frame 2025-09-26

Working on some improvements to the alpha. I'd appreciate any feedback before I cut a release: • new https://day8.github.io/re-frame/FAQs/alpha/ • improved https://day8.github.io/re-frame/api-re-frame.alpha/ • The main commit, https://github.com/day8/re-frame/commit/1881c0671f9719f77c24797e60d58f35f61ce215alpha compatibility> • You can combine re-frame.core and re-frame.alpha in the same app now. • The :safe and :forever subscription lifecycles are safer, even with regular (non-alpha) subscriptions as inputs.

🔥 2

I guess that's one problem with offering a dispatch-fn in your API... where exactly do you document each dispatch method? They're lumped together on reg. On the other hand, re-frame's original docstrings are pretty huge as it is, so there's precedent.

We autogenerate the markdown though (using docs/src/ns_to_markdown.clj), so maybe headings within a docstring could be assigned their own entries in the table of contents.

I'm getting a circular dependency error re-frame.alpha -> re-frame.alpha when using

{:ns-aliases {re-frame.core re-frame.alpha}}}}}

👀 1

btw I don't know if you've seen my issue on re-frame ? I've been using a different version of legacy-sub to send the correct argument to the input signal fn of subscription. I also had to do this patch for reg-sub-raw:

(defn reg-sub-raw
  "This is a low level, advanced function.  You should probably be
  using `reg-sub` instead.

  Some explanation is available in the docs at
  <a href=\"\" target=\"_blank\"></a>"
  {:api-docs/hide true}
  [query-id handler-fn]
  (registrar/register-handler subs/kind query-id
                              (fn raw-subs-handler-fn [db q]
                                (let [q (if (map? q)
                                          (-> (or (::rf/query-v q) [(q/id q)])
                                              (vary-meta assoc ::rf/lifecycle (q/lifecycle q)))
                                          q)]
                                  (handler-fn db q)))))

yeah, that will be merged

that's a key fix for making the alpha totally usable

I'm confused about the circular dependency... it has to be my setup I don't see why it would happen looking at re-frame's codebase

no, it's re-frame

okay, it should be fixed now on master. @rolthiolliere

👍 1

just merged your fixes, as well.

everything works great ! I may have to implement a lifecycle with LRU cache limit I'll try to follow your doc

The tricky thing I found about writing your own lifecycle is that reactions have some non-obvious behavior. You can't actually prevent memory leaks so easily. So I'm not sure if re-frame.query.alpha actually provides a good enough api for this purpose.

The FAQ is great but the api docs for reg is a bit too long, and the subsections are a bit hard to follow since they don't appear in the table of contents.

I think it was never documented but I've always used the "map" form for input signal

(reg-sub :x
 (fn []
 {:a (subscribe [:a]
  :b (subscribe [:b]})
 (fn [{:keys [a b]} ...)
might be worth a mention

Still working on the release. I found a bug in the :safe lifecycle, though.