Fork me on GitHub
#fulcro
<
2020-04-11
>
tony.kay04:04:31

Another RAD update: • Normalized report controls (NOTE: breaking change. Report parameters and top-level actions are now all focused into this concept) • Report page and selected row are now included in HTML5 route memoization. Reloading a paginated report with a sort/filter/selection will reset to exactly that. • Cleaned up report rendering a little • Added two new report controls • Added a number of helper functions in report ns that can be run from within report controls These are all in SNAPSHOT releases for the moment, and if you want to play with them in the demo then use the develop branch.

👍 12
myguidingstar07:04:02

David Nolen has just added this to Om's README:

myguidingstar07:04:08

This project is no longer under active development. If you'd like to use a library that's well maintained that was inspired by some of the ideas presented here see Fulcro

👍 48
😄 24
tony.kay08:04:45

Just did some performance testing on RAD demo in production mode (inspect, guardrails, and logging all impact that pretty heavily in dev mode). With the following build: TIMBRE_LEVEL=:warn shadow-cljs release main the demo comes in at about 460k compressed. The actual project files of RAD compress very very well, since they are just data. The total size of the UI files for all of the reports and forms is just a few K for each ns. This tends to imply that the size of a real RAD app will grow very slowly (as expected), since most of what you add from there will be these small nses. The performance is also quite good. In dev mode things like sorting by big decimals in the UI are rather slow. In release mode they are about 100x faster. Typical frame render times for most operations vary between 2ms up to about 21ms on my machine…the latter being a UI sort of 1000 paginated rows. Guardrails, since it uses spec, can be quite slow. In dev mode I often see it consuming 90% of a frame’s time. Of course most of this is Fulcro performance. RAD does do some things in render that I thought might be abusive, so I wanted to see if those were a problem. They appear not to be.

❤️ 36
tony.kay08:04:24

If you want to see the build report yourself, just type make report in the demo (on develop branch at the moment) and then open report.html. There are some things there that we can probably trim down (pprint is sneaking in, and should not be), so that will be future work.

folcon11:04:19

How hard is it to migrate to rad from the template? Or is that not advisable as it’s still in alpha?

tony.kay15:04:49

RAD is designed to be completely optional at every layer, and bi-directionally usable in Fulcro. There is nothing more to do than add the dependency to start using it.

tony.kay15:04:39

But, of course, it isn’t going to be very useful until you define your data model, figure out your backend (and if you need to write a db adapeter).

tony.kay15:04:08

A typical db adapter should not be more than a few 100 lines for most database.

tony.kay15:04:46

As far as advisable: it is still Alpha and API unstable, but the older the feature the more stable it is

folcon16:04:28

Ok, I’ll keep clear of it for now then =)… It feels like I need a better grip on how this all works before I dive into it.

tony.kay16:04:04

I suggest you play with it…you may be surprised how willing you are to tolerate an occasional API break (mostly keyword renames)

tony.kay16:04:30

and as a beginner you might find it fun to play with, and educational to read the source.

folcon16:04:14

I’ll take a look at it after I get some of these next bits working then =)…

folcon16:04:38

How to do you fetch data from the server post a successful login? I think I need to call load!, but not clear how to do that from the context of UI State Machines…

tony.kay16:04:00

you mean in the template? Don’t remember what that looks like, so your question is quite vague: here is the vague answer: the triggering and loading mechanisms of UISM have options that allow you to send your SM an event on ok or error.

folcon16:04:09

Ah, ok so I should take the fact that login generates :event/complete, and then under :state/logged-in add an entry for it?

(defn login ...
{...
::uism/ok-event    :event/complete
...}
...)

;; Like this?
:state/logged-in
{::uism/events (merge global-events
                 {:event/logout {::uism/target-states #{:state/logged-out}
                                 ::uism/handler       logout}
                  :event/complete {::uism/handler     (fn [env] (uism/load :user-data UserData))}})}
https://github.com/Folcon/fulcro-template/blob/master/src/main/app/model/session.cljs#L49

tony.kay17:04:30

don’t forget to pass env

tony.kay17:04:42

also pay attn to what state you’ll be in at the time…not sure why you’d be logged in while doing the auth

folcon17:04:14

Ah, ok. I might have misunderstood the statemachine, I thought the :state/logged-in was the logged in completed state

tony.kay19:04:41

yes, but where you receive “complete”, you’re still in the other state aren’t you?

folcon19:04:57

To be honest, I’m really not sure, I’ve found your video tutorial series, so I’m currently watching those =)…

folcon21:04:45

Finally worked out how to do it manually =)…

(df/load! SPA :all-people PersonListItem
                                                                       {:target [:component/id :person-list :person-list/people]})
I’ll figure out how to use the UI State Machines some other time…

markaddleman19:04:33

Hi - I'm trying out fulcro-rad-demo for the first time and am running into a few problems. I had to update index.html to point to the js/main/main.js and I'm getting 404 when the UI tries to access api endpoint. If this is expected, no worries. If not, I'll debug. Here's how I got going: I cloned the repo and switched to the develop branch. I started up the two servers by running

# in one terminal
$ shadow-cljs -A:f3-dev:rad-dev watch main
# in another terminal
$ clj -A:dev:f3-dev:rad-dev:datomic  
And then started up datomic by running
user=> (clojure.core/require 'development)
user=> (development/go)
in the repl.

mdhaney20:04:56

Did you also clone the other repos and point to them in your system deps.edn file? Also, make sure you’re loading the app from http://localhost:3000 and not the http server that shadow starts up (that’s just for tests).

Jakub Holý (HolyJak)21:04:48

Hi! I am at a loss here, how is it possible I am getting this error in the browser console: > [com.fulcrologic.rad.report:45] - No layout function found for form layout style :default when trying to render my report/defsc-report ? When I check

(-> com.example.client/app
      :com.fulcrologic.fulcro.application/runtime-atom
      deref
      :com.fulcrologic.rad/controls
      :com.fulcrologic.rad.report/style->layout)
then :default is there (as it should). And my other, similar, reports are working just fine, and they are all children of the same router.

4
Jakub Holý (HolyJak)07:04:13

The problem went mysteriously away after a few reloads

tony.kay23:04:30

@holyjak beware of possible renames…I’ve been doing heavy editing on reports

tony.kay23:04:27

@markaddleman sry, not doing support on develop…trying to keep it working, but only master is guaranteed to work at any given moment.

markaddleman23:04:57

No worries. Thanks!