Fork me on GitHub
#fulcro
<
2017-12-28
>
macrobartfast02:12:40

hmm... ./run-devguide.sh is failing due to /js/production-demos/cljs_base.js and /js/production-demos/demos.min.js 404's.

tony.kay09:12:00

@macrobartfast hm. Thanks for letting me know. I’m changing a bunch of that around.

tony.kay09:12:30

The new book is nearing completion. The thing you’re running is turning back into a shorter tutorial. Not merged yet.

tony.kay09:12:20

@macrobartfast Hm. I just that the script, and it works fine for me on develop branch

tony.kay09:12:54

you sure you used the right URL? It should not be trying to get production demos at all….perhaps you said demos.html instead of guide.html?

tony.kay09:12:17

The book has been updated: http://book.fulcrologic.com Most chapters complete now…though much editing probably remains.

tony.kay09:12:50

I’ll probably be merging it to develop along with the shortened (and renamed) tutorial soon.

LL09:12:39

Need help. If have cars with different colors:

[{:db/id 11 :car/name "car1" :car/color 21}.....]
[{:db/id 21 :color "red"}.....]
want to load them into the client db. For rational, the query result is {:car/color 21} instead of {:car/color {:db/21 :color "red"}}:
:started-callback (fn [app] 
                                   (df/load app :get/colors Color)
                                   (df/load app :get/cars Car))
the ui component of Color:
(defsc Color [this {:keys [db/id color]}]
   {:query [:db/id :color]
    :ident  [:color/by-id :db/id]})
If use
(defsc car [this {:keys [db/id car/name car/color]
  {:query [:db/id :car/name {:car/color (prim/get-query Color)}]}
the {:color/by-id {21 {:db/id 21 :color "red"}...} will be overwrite to {:color/by-id {21 {db/id 21}...}} What is the good way to deal with this? use {:query [:db/id :car/name :car/color} and manually convert the {:car/color 21} to {:car/color [:color/by-id 21]}?

wilkerlucio09:12:37

@tpliliang seems like you are trying to deal with the normalization yourself, this is now how the thing is supposed to be used, your query should return the full color on the cars, and then you should let fulcro do the normalization for you, a query like: [{:get/cars [:db/id :card/name {:car/color [:db/id :color]}]}] will be appropriated for your case

wilkerlucio09:12:27

remember that you are dealing with graphs, making the relationships work on the graph is what will make your code clean, if you start managing deps like your code example, I'm afraid you gonna have a hard time

LL09:12:56

@wilkerlucio Yes, I agree. I just think there maybe too many db loading in this case.

LL09:12:28

If the fulcro's normalization can just create {:color [:color/by-id 21]} without overwriting the table :color/by-id, when it meet the input data only have a :db/id.

LL10:12:57

Or morphing the loaded data by using :post-mutation.

wilkerlucio10:12:41

the normalization is there exactly so you don't have to do this kind of work, unless you have the performance problem, I suggest you avoid trying this kind of optimisation, on fulcro you use transit that compress a lot already, it seem like a premature optimisation @tpliliang

LL11:12:06

@wilkerlucio ok, Got. Thanks.

myguidingstar14:12:39

I've just learned about fulcro-sql and pathom. My guess is that they're related. Any reason why fulcro-sql is not implemented on top of pathom?

wilkerlucio15:12:37

@myguidingstar they are not related actually, those were developed independently, I have plans to support SQL in pathom, but there are other things with higher priority at this point

wilkerlucio15:12:42

pathom is currently missing docs around the connect feature (currently there is only a video about it), but I stand by that and I should be able to get better docs on that soon (next 1 or 2 weeks), with that shouldn't be that hard to write a sql engine on top of it

myguidingstar17:12:45

fulcro-sql is quite convenient but I'm not sure if it will be flexible enough to put an authentication layer afront. I guess a pathom-based version will do

tony.kay18:12:53

@myguidingstar See the demo on query security. There’s nothing preventing you from putting a security layer on the graph query itself. Fulcro-SQL was actually written at about the same time as Pathom. I wrote it because I kept getting questions about using SQL databases. I don’t have a ton of time to maintain/expand it, but it is a small amount of code and it clearly demonstrates how one can interface with arbitrary databases on the back-end.

tony.kay18:12:17

I’m glad that pathom has come along…having a nicer way to build parsers will be a big boon for all kinds of interfacing: from GraphQL to SQL.

myguidingstar18:12:29

do you mean automatic graphql api from fulcro?

tony.kay18:12:29

Not sure how "automatic "it can be. But certainly interested in having something that interfaces easily. I do think there's a fair bit of an automation that can be done.

edward.scott18:12:45

I want to have a form with a dropdown-input where the options are dynamic e.g. depend on some values in the current state. Not sure how to achieve this, any pointers?

edward.scott19:12:54

Never mind. It's just data 🙂

wilkerlucio19:12:58

@tony.kay @myguidingstar in pathom connect, there is a feature (experimental) that can read a graphql schema and "import" it, I hope to get more docs around all of this in the next few weeks

macrobartfast22:12:15

@tony.kay well, now, apparently I can't rtfm! I was going to localhost:8080, not localhost:8080/guide.html, even though I was told the right url right in the script output.

macrobartfast22:12:43

thank you for figuring out my issue!