biff

A web framework + self-hosted deployment solution for Clojure. Repo: https://github.com/jacobobryant/biff. Docs: https://biff.findka.com
2020-06-22T15:08:48.005Z

I'm running on Windows, and everything seems to be working fine. I am using git-bash for my console.

2020-06-22T15:08:50.005200Z

I had some confusion trying to inspect the system atom from the shadow-cljs nrepl, vs the nrepl port supplied in the docs. But I sucessufully played with both repls: shadow-cljs browser repl, and clj repl with biff system and (refresh) .

2020-06-22T15:27:58.009100Z

@foo I am trying to integrate and use https://github.com/hoplon/hoplon/wiki in Biff, instead of Rum, for now, because all of my front-end code is in that. I am hopin that this would not be too sticky? I replaced the rum/mount fn with a hoplon mount fn and hoplon component. https://github.com/ryolyo/example/blob/master/src/example/client/app.cljs#L16-L31 I converted example.client.db data into https://github.com/hoplon/javelin cells (reactive atoms). https://github.com/ryolyo/example/blob/master/src/example/client/app/db.cljs I'm not sure what to make of, or do with:

; same as (do (rum.core/cursor-in db [:sub-data]) ...)
(u/defcursors db
  sub-data [:sub-data])
Seems like I don't need it for the client-side data flow. But it shows up in example.client.app...
(reset! s/system
    (bc/init-sub {:handler m/api
                  :sub-data db/sub-data
                  :subscriptions db/subscriptions})
How does this code, or Rum in general, play a role in the client/server subscription model? Is it feasible to substitute Hoplon for Rum like this, to render the dom, and curate the reactive state? Thanks!

2020-06-22T20:35:44.012800Z

Yeah, you should be able to use any UI framework just fine. The only thing Biff cares about is the values of :sub-data and :subscriptions which need to be atoms of some kind. subscriptions is your input; i.e. you swap things in and out of it to specify what data you want to subscribe to. sub-data is the output. Biff will swap the results of your subscriptions in and out of this atom, so you'll want to react to changes in that atom some how. It's up to you how you swap and react to those atoms, so using hoplon's tools instead of Rum's is fine

2020-06-22T20:38:56.015300Z

fyi if you're able to get a reference to biff.core/system from the shadow-cljs repl, it most likely is the wrong reference. Shadow-cljs runs in a separate jvm. While it is possible to eval the contents of biff.core from that process, you'd want to do it from the nrepl connection that biff provides. I'm thinking of starting the shadow-cljs server from within biff to make this smoother (I often eval things that end up getting sent to shadow-cljs's repl by accident)

2020-06-22T20:41:21.017700Z

as far as the defcursors thing, you can replace sub-data with e.g. (def sub-data (atom nil)) or the equivalent of that in Hoplon. I haven't used Hoplon before, but if their reactive atoms are like reagents, then you can have sub-data be a reactive atom, and then have subscriptions be a reaction of sub-data (that's what the example app does)

2020-06-22T20:48:04.019Z

just looked at the code you linked-- I think it'll work if you do this:

(def sub-data (cursor-cell db :sub-data))
(def data (cell= (apply merge-with merge (vals sub-data))))