Fork me on GitHub

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


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


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


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


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?


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


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


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]}?


@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


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


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


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.


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


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


@wilkerlucio ok, Got. Thanks.


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?


@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


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


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


@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.


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.


do you mean automatic graphql api from fulcro?


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.


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?


Never mind. It's just data 🙂


@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


@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.


thank you for figuring out my issue!