Fork me on GitHub

With fulcro-template, I am getting an exception in app.model.session, the compiler says java.lang.RuntimeException: Invalid token: ::m/returning


I also have to say that I updated the dependencies in deps.edn, so I guess something changed in Fulcro?


you sure the alias m is namespaced?


could be in a comment


clj(s) won’t compile a comment that uses an alias if the alias is removed from the requires


(comment ::m/a) and #_:this-kind)


things that follow ; are completely ignored


Just published a post about implementing client-side routing in fulcro at I haven't blogged before and wouldn't consider myself a fulcro expert; I'm happy to hear any constructive feedback.

❤️ 12
Piotr Roterski10:03:45

Thanks @U0DUNNKT2, that's a really well written and focused post! I submitted a link to it on /r/fulcro Feel free to post there as well. Even though Fulcro has an extensive documentation, I think these kind of blog posts are essential in community building and make learning it much more approachable. I love that you share this neatly organised repo alongside. Definitely looking forward for more stuff like this!


Oh neat, I will read this. I'm gonna need this sort of routing. I will probably use it together with reitit


💡So that’s how you handle query params in the url! Thanks!

Jakub Holý (HolyJak)16:03:16

In RAD, how do I fetch the initial data for a report? I have assumed that with ::report/run-on-mount? true it would run the query automatically but it isn't the case, the report shows empty. Do I need to df/load! manually, as with standard Fulcro? How? Thank you! When I run (df/load! app :kostnadsdeling/all-organizations ui/OrgList), the report will show the data but it does not look correct in the DB - the root key :kostnadsdeling/all-organizations is a vector of many [:component/id :OrgList] . I wanted it to be what in practice is under :tem-organization/organization-number, i.e. ["org1" {:tem-organization/organization-number "org1"},..]. The LOADed query is

  [{:kostnadsdeling/all-organizations ;; twice ?!
   [ _]]}]
The report has ::report/source-attribute :kostnadsdeling/all-organizations and I have
(defattr all-organizations :kostnadsdeling/all-organizations :ref
  {::attr/target    :tem-organization/organization-number
   ::pc/output      [{:kostnadsdeling/all-organizations [:tem-organization/organization-number]}]
   ::pc/resolve     (fn [{:keys [query-params] :as env} _]
                         {:kostnadsdeling/all-organizations (queries/get-all-ksd-organizations env query-params)}))})


@holyjak It does auto run with that option. Sure you have data?


look in inspect


you should not use load!…you can trigger a refresh from UI in the report with (`report/reload! reportinstance)`


Use inspect to verify that your network request is sending the right query, and that you’re repsonding with right value


NOTE: on current SNAPSHOT I’m actively working on report


and I’ve renamed a few more things 😜


I’ll push an update shortly…just polishing it off


added a bunch of cool stuff

parrot 4
Jakub Holý (HolyJak)18:03:19

I looked in inspect - network and the only request there is

i.e. it is not sending the query at all. I am on 434725f - (origin/develop, origin/HEAD) Merge tag '0.0.1-alpha' into develop (22 hours ago)
   (comp/class->any com.example.client/app OrgList))
returns nil and no new log in the Inspect - Network appears. And there is an error and a warning logged: > ERROR [com.fulcrologic.fulcro.ui-state-machines:?] - Attemped to trigger event :event/run on state machine [:component/id :OrgList] , but that state machine has not been started (call begin! first). > WARN [com.fulcrologic.fulcro.ui-state-machines:?] - UNEXPECTED EVENT: Did not find a way to handle event :event/run in the current active state: null (I took the RAD demo, added a new Root component that includes a single report component: (report/defsc-report OrgList ..) (def ui-org-list (comp/factory OrgList)) (defsc Root ... (ui-org-list org-list))))) )


ok, RAD demo pushed, along with new snapshot versions of libs. • ::report/edit-form became ::report/form-links (see demo). Allows you to create links to many diff things on a single row. NOTE, this works by leveraging a resolver that can give the correct ids from the back end . In the demo case (invoice list) the :account/id has a resolver on an :invoice/id input. This allows the report to automatically get both IDs for each row. See was the wrong name, renamed to ::report/row-pk • Added ::report/actions and ::report/row-actions. See demo. • ::report/BodyItem is no longer needed in reports, unless you want to custom render, but then it simply needs query/ident, NO report params • ::report/row-style and ::report/layout-style now exist for choosing (or plugging in) custom report layouts and row renderers. See demo. Predefined values for these are :list and :table. If you use :list, then only (up to) two columns are supported. • MANY of the keys in things now accept either scalars or functions. I still need to make the parameters consistent. This allows for things like easy i18n, computed labels, etc.


@holyjak No, you cannot use a report CLASS, it must be a report instance…and you should probably not be calling it unless you’re writing a custom renderer (it must be called from such a renderer, since that’s where you’ll get the on-screen instance)

Jakub Holý (HolyJak)18:03:33

Well, doesn't this turn the CLASS into an INSTANCE? (comp/class->any com.example.client/app OrgList)


if it is on-screen, yes


Reports start when they are routed to. Make a landing page, then route to the report.


I don’t have a hook for you to start with a report on screen at app load

Jakub Holý (HolyJak)18:03:59

ok, that explains it, thanks!


See report.cljc…this line:

(uism/begin! app report-machine report-ident {:actor/report report-class}
          {:route-params route-params})


that’s what you do to start a report


(route params can be empty in this case)

👍 4


(uism/begin! app report/report-machine [:component/id :OrgList] {:actor/report OrgList})

❤️ 4

should work


I’ll make a helper function


snapshot pushed with helper: (report/start-report! app OrgList)


I wish I had time to make more videos…alas, have to work and pay the bills 😞