This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2020-03-25
Channels
- # announcements (8)
- # aws (50)
- # aws-lambda (6)
- # babashka (25)
- # beginners (119)
- # bristol-clojurians (5)
- # calva (25)
- # chlorine-clover (23)
- # cider (6)
- # cljs-dev (125)
- # clojure (63)
- # clojure-austin (1)
- # clojure-belgium (1)
- # clojure-dev (48)
- # clojure-europe (11)
- # clojure-italy (2)
- # clojure-nl (5)
- # clojure-spec (3)
- # clojure-uk (66)
- # clojurescript (14)
- # core-logic (5)
- # datomic (13)
- # emacs (10)
- # events (2)
- # fulcro (37)
- # graalvm (11)
- # hoplon (95)
- # jobs-discuss (9)
- # juxt (11)
- # kaocha (16)
- # meander (13)
- # off-topic (24)
- # pedestal (4)
- # re-frame (36)
- # reagent (10)
- # reitit (15)
- # ring-swagger (5)
- # shadow-cljs (23)
- # spacemacs (2)
- # sql (13)
- # tools-deps (32)
- # xtdb (11)
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?
clj(s) won’t compile a comment that uses an alias if the alias is removed from the requires
Just published a post about implementing client-side routing in fulcro at https://chrisodonnell.dev/posts/giftlist/routing/. I haven't blogged before and wouldn't consider myself a fulcro expert; I'm happy to hear any constructive feedback.
Thanks @U0DUNNKT2, that's a really well written and focused post! I submitted a link to it on /r/fulcro https://www.reddit.com/r/fulcro/comments/fonu9c/fulcro_dynamic_router_pushy_chriss_blog/ 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!
Thanks!
Oh neat, I will read this. I'm gonna need this sort of routing. I will probably use it together with reitit
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
[{:kostnadsdeling/all-organizations ;; twice ?!
[:tem-organization/organization-number
:tem-organization/organization-number]}
[:ui.fulcro.client.data-fetch.load-markers/by-id _]]}]
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} _]
#?(:clj
{:kostnadsdeling/all-organizations (queries/get-all-ksd-organizations env query-params)}))})
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
I looked in inspect - network and the only request there is
[{(com.example.model.account/check-session)
[:com.fulcrologic.rad.authorization/provider
:com.fulcrologic.rad.authorization/status
*
:tempids]}]
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)
(report/reload!
(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 https://github.com/fulcrologic/fulcro-rad-demo/blob/develop/src/shared/com/example/model/invoice.cljc#L50
• ::report/column-key
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)
Well, doesn't this turn the CLASS into an INSTANCE? (comp/class->any com.example.client/app OrgList)
Reports start when they are routed to. Make a landing page, then route to the report.
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})