Fork me on GitHub

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


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


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 )


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.


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?


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

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


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


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 🙂


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.


@dansudol Yes: the indexes.


See, for example, prim/ref->any


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


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


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.


@thomasmoerman RTM: 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.


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

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