Fork me on GitHub
#fulcro
<
2021-08-28
>
Alister Lee11:08:54

I have one-to-many nested structure with a back-link in the child. When using df/load! from the root (but not on construction) the child is getting a nil back-link. The query goes out and comes back like this which seems right to me (pathom has short circuited the back-link :account-group/name):

Request
[{:account-group/all
  [:account-group/id
   :account-group/name
   {:account-group/accounts
    [:account/id
     :account/name
     {:account/group_id
      [:account-group/id
       :account-group/name]}]}]}]
Response
{:account-group/all
 [{:account-group/id 3,
   :account-group/name "Untitled group",
   :account-group/accounts
   [{:account/id 4,
     :account/name "Untitled account",
     :account/group_id 3}]}]}
When it is merged, the DB looks like this:
:account/id {4 {:account/group_id [:account-group/id nil] ;; <- why is this nil?
                :account/id       4
                :account/name     "Untitled account"}
I am using a series of queries, including an empty SC to construct the join back:
;; account-group.cljs
(defsc AccountGroup [...]
       {:ident ::id
        :query [::id ::name 
                {::accounts (comp/get-query Account)}]}
       ...)

;; account.cljs
(defsc GroupName [...]
       {:ident ::account-group/id
        :query [::account-group/id ::account-group/name]})

(defsc Account [...]
       {:ident ::id
        :query [::id ::name
               {::group_id (comp/get-query GroupName)}]}
       ...)  
I edited this down quite a bit, so hopefully I didn't lose anything salient... Thanks very much for any clues!

Alister Lee10:08:25

The goal (if that isn't clear) is to enable the to-many child to be able to see an attribute of its parent.

Alister Lee10:08:46

Is the problem that the child backlink returns an int? Perhaps it should return a [::account-group/id 9]?

Alister Lee11:08:26

Ah - that's it. I'm trying to work out where this should go in the book - I was thinking about writing something for s.7.2.1 EQL/Joins ... It might end up quite long if it covers to-one, to-many, proxy SCs, and mutation impacts..

Alister Lee22:08:11

Perhaps just: returning idents

Jakub Holý (HolyJak)12:08:06

Hi! Anybody knows how to override a dependency on Fulcro with a local checkout of it, for the frontend code? See https://clojurians.slack.com/archives/C6N245JGG/p1630154685076700 Thank you!

Jakub Holý (HolyJak)13:08:32

Hello folks! I need you help deciding where to focus my efforts for helping newcomers getting started with Fulcro, now after having finished the [Minimalist Fulcro Tutorial (MFT)](https://fulcro-community.github.io/guides/tutorial-minimalist-fulcro/) and [Fulcro-examples](https://github.com/fulcro-community/fulcro-exercises). What would help / have helped you? Where do you see a hole in the current materials? Some of the things I consider are: 1. Adding more stuff to fulcro-exercises. Not really sure what?? Perhaps: * A more complete, CRUD app with create (=> need for tempid), handling of optimistic updates that failed on the server, chaining of mutations (via ok-action), ... * An exercise focused on Pathom resolvers - though I would need ideas for this one * ... 2. Writing an "Advanced Minimalist Fulcro Tutorial" with at least some of these topics: * UISM * Routing * Union, recursive, dynamic query * Tmpids * Returning data from mutation * component.raw 3. Creating a minimalist-fulcro-template[-backendless], similar to fulcro-template but focused on learning and playing around, not making a production app, thus being much simpler to understand 4. A natural continuation of MFT and the exercises is to try to make a simple app. So I could create a guidance for that, starting from the minimalist-fulcro-template, offering some ideas what to build - perhaps even providing data sets, including for example * deployment to Heroku or something * using a real DB (RDBMS?) * It would be nice if I could provide, for selected apps, some "checkpoints" and the ability to publish one's solution and compare it with those made by others 5. A Deployment Tutorial - e.g. to Heroku or AWS (though it might already exist?) 6. A (minimalist) RAD tutorial My time is limited and I cannot do everything. So what will give us most bang for the buck?

Chris O’Donnell14:08:44

Each of the topics you mentioned would be great, I'd say. Routing and temp ids are the most important in my eyes.

👍 2
sheluchin14:08:31

Some areas where I think more explanation and/or some exercises would be helpful: • +1 for tempids • UISM and form state handling • automated testing and organizing your code so it's easier to test • making production builds and deploying them

🙏 2
Jakub Holý (HolyJak)21:08:09

BTW ideas for exercise to add to fulcro-exercises / puzzles are always welcome. The more detailed the better! 🙏

Mateusz Mazurczak09:08:29

For me it would be 2 (wiritng advanced minimalist fulcro tutorial) and after that 6

👍 2
Hukka10:08:30

I did the exercises last week, and then immediately stumbled upon right use of link queries. So an advanced tutorial and exercises seems most crucial, coming from other web frameworks. Deployment, whole apps, databases etc. are something I know, and also are covered elsewhere, so I'm dearly hoping for more examples of fulcro specific things.

👍 2
Jakub Holý (HolyJak)17:08:30

FYI I've added a section on troubleshooting when data/fields "disappear" between a Pathom resolver and Fulcro https://blog.jakubholy.net/2020/troubleshooting-fulcro/#_frontend_backend_communication

👏 1