Fork me on GitHub
#fulcro
<
2021-01-29
>
mss04:01:27

sanity checking what appears to be a pretty weird bug, in the following example which is run in my :client-did-mount cb, the load! call won’t run until the transact! call finishes and returns to the client, correct?

(fn [mounted-app]
  (comp/transact!
    mounted-app
    `[(current-user/create-user-session ~{:user/id 123})])
  (df/load!
    mounted-app
    [:user/id 123]
    User
    {:target [:current-user]}))

holyjak07:01:45

I believe the action of the mutation is executed before the load! but if there is a remote part to the mutation, that is triggered but not waited for.

avocade11:01:59

Hey guys, a question regarding globally handling stuff we send to, or ask for, from the backend: Is there a way to always elide certain keywords in loads and mutations, like what we get when using :without in a load!? So we don't have to remove common things explicitly. There is an existing method in fulcro of adding a :ui/ prefix to keys, which maybe could be allowed to be extended? Preferably allowing both keywords and predicate functions

avocade13:02:42

Thanks, will check those out 👍

holyjak11:01:32

FYI I have now published https://github.com/fulcro-community/guides/blob/main/minimalist-fulcro-tutorial/index.adoc - but your comments and suggestions are still very welcome! I have also updated https://github.com/fulcro-community/guides/blob/main/learning-fulcro.adoc to include it though I am not sure where exactly it should go. Now it is essentially as the first learning step, which is OK because it is intended as such - but the problem is that it focuses only on "how" and does not explain why Fulcro is the way it is. I feel that the reader should be exposed to the rationale for Fulcro early but I am not sure where to point her/him. https://fulcro.fulcrologic.com/ is too high-level, https://book.fulcrologic.com/#_fulcro_from_10000_feet in a way gets in too much detail and includes some of the same things as in the Tutorial. Any suggestions?

🎉 5
🙏 2
👍 1
uwo17:01:20

Hey. thanks for this. very succinct

❤️ 1
1
Tuomas17:01:19

I myself really like how rust made touched on rationale in it's foreword https://doc.rust-lang.org/book/foreword.html and introduction https://doc.rust-lang.org/book/ch00-00-introduction.html#who-rust-is-for I really think you should start with why

👀 1
futuro22:01:38

The first time Fulcro clicked for me was in the interview with Jacek Schae, specifically because Tony spoke about the original impetus and then the idioms and foundational concepts. I’m afraid I don’t have much in the way of concrete suggestions, but maybe those interviews would help. https://podcasts.apple.com/us/podcast/clojurescript-podcast/id1461500416?i=1000479361034

👂 1
andre.richards13:01:23

Thanks, I have started reading it. Looks good so far. Small spelling mistake in last sentence of Prerequisities: 'vlue proposition' should be 'value proposition' I can file issue/pr if you prefer.

holyjak19:01:12

thanks, tkovis already fixed it

yubrshen05:02:25

@U0522TWDA Thanks very much for the minimalist tutorial! I'm studying in details. I especially appreciate the section on Prerequisites, which is really I need. I'm studying "Key concepts and elements" now. It seems that the following might have a typo App A reference to the current Fulcro application, containing configuration, the client DB, etc. Produced by app/fulcro-app and used when calling transact! or load! when a component's this is not available. Referred to as app in code samples. Maybe, this should be data ?

yubrshen05:02:31

@U0522TWDA For Client DB The client-side cache of data. It is a map of maps: entity name (e.g. `:person/id`) → entity id value (e.g. `123`) → properties of the entity (e.g. `{:person/id 123, :person/fname "Jo", :person/address [:address/id 3]}`). (For convenience, we use the name of the id property as the "name" of the entity - thus `:person/id`, `:user/username`.) I feel the above still somehow convoluted. I haven't figured out. I wonder if if would be better to separate the description of the abstract structure, then follow with a concrete data samples of a client DB? If the client DB is a map, what are the keys of this map (the highest level)? The entity, such as person, car, etc.? As values of the highest map, themselves maps, what are the maps (keys, values)? For entity person, the map of keys of id, name, age, cars, etc.?

holyjak08:02:04

@U2QGRCMSM You are welcome 🙂 1) What typo? What do you mean by "`this` should be data"? It refers to the first argument of defsc, it is traditionally called this . 2) Thanks, I will think about simplifying. > If the client DB is a map, what are the keys of this map (the highest level)? The entity, such as person, car, etc.? As the text says: "entity name (e.g. `:person/id`)" > As values of the highest map, themselves maps, what are the maps (keys, values)? they are maps from "entity id value (e.g. `123`) → properties of the entity" > For entity person, the map of keys of id, name, age, cars, etc.? Yes. Or, in my example, :person/id, :person/fname, :person/address

yubrshen06:02:59

@U0522TWDA Thanks! I forgot the special this

yubrshen15:02:00

@U0522TWDA With English no as my native language, I feel the following for the description of Client DB is clearer to me:

The client-side cache of data. It is
a map of maps:
entity name  → entity id value  → properties of the entity

For convenience, we
use the name (keyword) of the id property
as the "name" of the entity 
thus :person/id for the entity Person

For example,
:person/id -> {:person/id 123, :person/fname "Jo", :person/address [:address/id 3]}

It is fed by initial data and loading data from the backend and can be changed by mutations.
It's just a refactoring, to make it less "complex".

holyjak09:02:35

Thank you! Applied 🙂