This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
- # announcements (1)
- # babashka (32)
- # beginners (27)
- # calva (4)
- # clojure (18)
- # clojure-australia (2)
- # clojure-europe (11)
- # clojure-spec (8)
- # clojure-uk (15)
- # clojurescript (8)
- # cursive (14)
- # datomic (12)
- # fulcro (36)
- # graalvm (3)
- # graphql (2)
- # jobs (1)
- # meander (1)
- # pathom (5)
- # pedestal (12)
- # re-frame (1)
- # reagent (1)
- # reitit (2)
- # testing (12)
- # vim (2)
I have created https://github.com/fulcro-community/guides as a home to community created guides and created a draft of https://github.com/fulcro-community/guides/blob/main/learning-fulcro.adoc - I really need help with this one!
yup, I'm (slowly) pulling one together! Interesting finding though - it will be very hard to have running examples in any browser based example material - defsc is very heavily based on clj code in the macros, making sci a very hard to use method of getting editable running examples.
Yes 😢 I looked at that (though not Sci) a way back. Having a server that would compile and return the code is the only solution I found. Perhaps an AWS Lambda or similar with limited throughout (to keep charges negligible)...
@U2QGRCMSM Pins are not personal. You pinned this message to the channel.
🙏 If you have any input on how to best learn Fulcro, please https://docs.google.com/document/d/1XMWwwnxtukZ0o3ev4GH2Kpa8MvX4z-r4kYKJMaMBw2A/edit?usp=sharing that I will feed back to ☝️
I’m building a simple Todo app in Fulcro RAD that has Todos organized into Projects. I have a simple RAD report that lists all Projects. Projects can have many Todos (via a ref attribute). My report’s source-attribute is :projects/all-projects, a global resolver that returns all :project/ids. My report columns are “:project/label”, “:project/project-todos” and “:todo/label” (:todo/label is a “to-many” :ref from :project/project-todos to :todo/id). When I render the report, it displays the :project/label and :project/project-todos a vector of id’s (which makes sense). However, I would like to display the :todo/labels in the report. What’s the proper way to have the report render the individual :todo/labels themselves instead of the “idents in a list” that it displays by default? Link to the c.e.model.project.cljc: https://github.com/aeberts/fulcro-rad-demo/blob/develop/src/shared/com/example/model/project.cljc And a link to the c.e.ui.project.cljc: https://github.com/aeberts/fulcro-rad-demo/blob/develop/src/shared/com/example/ui/project.cljc
The trivial answer is to make a resolver on an invented property name on the back-end. The alternative is more complicated, but there are many alternatives. Is the invented propery like
:project/sample-todo-labels where the resolver sends back a comma-separated string not good enough?
The main alts are: • Custom BodyItem • Row query inclusions (alternate to prior, cannot be used together) with a custom column renderer.
Hi @U0CKQ19AQ I think the invented property name you suggested would work in most cases. Does the invented property need to have an associated attribute defined in the model or is defining a resolver sufficient for this approach?
For learning purposes, I’m curious about how custom BodyItem and row query inclusions would work. Is there some example code somewhere that implements that? Thanks for the info!
On the other: Reports have to have a component for the report rows. The macro, by default, generates one (with
-Row as a suffix to your report component’s name). That generated row component has the query for the cols + row query inclusions and an ident based on the id attribute of the row. If you specify BodyItem then you’re making the row component. It’s just a standard Fulcro component. You specify the ident, query, etc. From there the report component will just pass you props for the row, which you can render, or you can call the helper for row rendering the that plugin uses.
Ok - that makes sense. Thanks. What is the name of the macro that generates the
it generates your report component, and if you don’t tell it the row component (BodyItem), it generates that too
defsc-report Doh! I probably could have guessed that one..
@U0G3C3USJ might this example (linked) help? https://gist.github.com/holyjak/207ed33c9ee7e003b9a779fa47c32d91
@U0CKQ19AQ could you be so kind and elaborate on
> Row query inclusions (alternate to prior, cannot be used together) with a custom column renderer.
namely what do you mean by "a custom column renderer"? I know I can have a custom
ro/column-formatters but that does not help me because I do not have a column for the child entites (todos) added via
row-query-inclusion . Did you mean essentially replacing the default
sui-report/render-table-row (https://github.com/fulcrologic/fulcro-rad-semantic-ui/blob/4e331c855ef681152a418ece636628adb7303e25/src/main/com/fulcrologic/rad/rendering/semantic_ui/report.cljc#L50) with a custom one, that both renders the report columns and the row-inclusion-provided todos?
I mean you can do a bunch of different things. There are escape hatches everywhere. You can customize render of a column with column formatters, you can take over row query/ident/rendering with BodyItem, you can take over the entire rendering of the table by supplying a body, etc. The generated row component generates a query. Read the macro. See where row-query-inclusions is used? See where BodyItem overrides the generated one? It’s pretty straightforward in the code I think. The rendering plugin doesn’t have many constraints from RAD itself (other than a basic entry point). I wrote SUI renderers one way, but there is definitely room to do it others.
Thank you. I did have a look at the code. My understanding it:
1. I can add the data using
row-query-inclusion but then I cannot use
column-formatters to show them - because on which column would I do that? There is no column for the data, it was added via query inclusion. Unless I add a dummy attribute and take over its column with a custom column formatter that would render the data from the query inclusion there.
2. Or I can have specify a
ro/BodyItem with the desirable query and e.g. a custom row rendering to display them.
3. (I'm sure there are other, though perhaps more involved, solutions, such as completely replacing the report layout)
Is that correct?
Thank you all for your recommendations. I've finished following the chapter 4, and completed the coding, and it worked. I got some feeling of the magic. I still find it hard to write query and mutation on my own. I'll watch the video hoping to develop better understanding of query, and mutation. It also occurs to me that it seems Fulcro's database assume a graph database model (node, edge, query, ident, etc.). I might need better understanding and intuition of graph database model as prerequisite to be more comfortable with Fulcro. I wonder if my guess is on track? Also any expert advice of good material of graph database introduction? Thanks again!