re-frame

Kimo 2025-09-26T13:39:56.156049Z

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
Kimo 2025-09-27T10:25:40.214979Z

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.

Kimo 2025-09-27T10:26:43.187819Z

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.

rolt 2025-09-26T14:40:20.093919Z

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

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

👀 1
rolt 2025-09-26T15:25:57.728329Z

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

Kimo 2025-09-26T15:26:25.403379Z

yeah, that will be merged

Kimo 2025-09-26T15:27:16.027499Z

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

rolt 2025-09-26T15:39:35.091289Z

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

Kimo 2025-09-26T15:39:48.256259Z

no, it's re-frame

Kimo 2025-09-26T16:03:57.918749Z

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

👍 1
Kimo 2025-09-26T16:21:37.475539Z

just merged your fixes, as well.

rolt 2025-09-26T16:25:11.754119Z

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

Kimo 2025-09-26T16:32:02.951059Z

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.

rolt 2025-09-26T16:32:51.510749Z

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.

rolt 2025-09-26T16:37:50.593449Z

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

Kimo 2025-10-22T21:05:46.656009Z

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