Fork me on GitHub
#fulcro
<
2019-07-30
>
exit215:07:48

Are there any modal examples for Fulcro? Was thinking about making a global modal that has some root level ui/ app-state entry

souenzzo15:07:27

I use material-ui and modals are just a component that can be used at any level of the app.

daniel.spaniel15:07:14

is there a way in fulcro to get the instance of a component that is currently being rendered ( i have the ident for it but not sure where to look )

daniel.spaniel15:07:41

it is an odd use case i will grant you

Thomas Moerman16:07:29

Q: I sometimes use this snippet to query for something in the DB from within a transaction:

(-> [{ident query}]
    (prim/db->tree state-map state-map)
    (get-in [ident]))
Is there a way in which I can query all entries in a Fulcro DB "table" at once, currently i loop over a manually created collection of idents using the snippet above.

exit217:07:08

Is it possible to pass the same this into a prim/factory to a child from a parent? Or should I just use a regular defn and pass this as an arg?

tony.kay18:07:26

You can do the latter. You should never pass this to prim/factory…it takes classes. If you mean “can you pass this as a prop to a factory?“, the answer is “only as computed data”.

👍 4
tony.kay18:07:08

factories of Fulcro classes expect to be passed props that are generated from the query

souenzzo17:07:30

You can do both ways, but usually you don't need this, you need #(some-thing-with this)

tony.kay18:07:19

I’ve made good progress on a tool that can help with porting F2 to F3. Right now it is a general tool that I have not finished, but it currently does most of everything needed to make it possible to set up something to automate porting, and is meant to be a “better sed” for fixing clj/cljs/cljc files. Would appreciate feedback. The README is up-to-date, and it should generally work as described. More to come 🙂 https://github.com/fulcrologic/porting-tool

16
tony.kay05:07:06

I’ve decided to switch over to rewrite-clj for the file handling on this…so there’s a bit of rewrite work to do. The plain reader handling of files is insufficient for our purposes. Rewrite-clj will allow me to preserve whitespace, comments, etc. without have to basically customize the reader through hacks.

tony.kay18:07:41

@dansudol Yes: the indexes.

tony.kay18:07:50

See, for example, prim/ref->any

tony.kay18:07:16

Fulcro has indexes of every component on-screen by class, ident, and keywords that they query for.

tony.kay18:07:46

class->any, class->all, ref->components, ref->any, and key->components (this latter one is in the protocol, but has no prim wrapper)

tony.kay18:07:05

technically ref->components directly uses key->components in F2, so it will work for kws, but you should not trust that F3 will preserve that, since it is semantically incorrect.

tony.kay18:07:07

@thomasmoerman RTM: http://book.fulcrologic.com/#_link_queries realize that tables are jsut top-level (entries in the root node), so you can use link queries…then you can use vals on the map you get back. oh…you mean within a mutation. No, if you need denormalized data you have to run db->tree yourself. Fulcro has no idea “which view” to denormalize against…there could be many diff components that “share” idents but have diff queries against that data. You might consider passing the data to the mutation as a param, since the UI will have the denormalized data.

Thomas Moerman19:07:05

Thanks. The issue in my app is that there is a circularity in the data model which makes some UI queries impossible (I think), or at least difficult to design. That's why I need a non-trivial query in one of my mutations to connect the dots.

tony.kay05:07:43

So, you could use vals on the table…something like this should work:

(mapv
  (fn [entity]
    (db->tree query entity state-map))
  (-> state-map :table-name vals))