fulcro

Book: http://book.fulcrologic.com, Community Resources: https://fulcro-community.github.io/, RAD book at http://book.fulcrologic.com/RAD.html
tony.kay 2020-09-25T03:55:55.023900Z

Just finished the Inspect fixes for the above stuff. A new version of the electron app is here: https://github.com/fulcrologic/fulcro-inspect/releases/tag/electron-3.0.0-2 Requires Fulcro 3.4.0-SNAPSHOT (SHA df51817c7c0819b4bfabae600656c978bd476022) I spent nearly 12 hours on this today, and I’m very happy with the result: • EQL tab (renamed from Query) now supports using reader-tags. Doing so generates a transit TaggedValue, so it can support your custom on-the-wire types. • EQL tab can now properly show the result of mutations. The prior item makes it possible to send custom type values as parameters. • Transaction/network tab also properly show custom types as if they were just EDN tagged values (even though they are transit) • DB view(s) will show custom types as tagged values At this point I’m done messing with Inspect for a while, sans bugs. I’ll be using the new version myself for a few weeks to make sure it is solid, then I’ll update the Chrome extension. At that point people who need to use older versions of Fulcro will have to build an older version of the chrome plugin itself, or use older versions of the Electron app.

10👏3🎉
tony.kay 2020-09-25T03:57:12.024800Z

There is probably one rendering bug I’ll fix, but it’s trivial: the database flickers. I intended to show the old version until the new one arrives, and had that working. Regression from another change.

2020-09-25T12:22:10.026600Z

@tony.kay i noticed that the Fulcro YouTube tutorial playlist at https://www.youtube.com/playlist?list=PLVi9lDx-4C_T7jkihlQflyqGqU4xVtsfi includes the “Every Clojure Talk Ever” talk… which i’m guessing was not your intent.

tony.kay 2020-09-25T15:29:04.027800Z

strange…not sure how that happened

currentoor 2020-09-25T17:31:36.028100Z

that's a really good talk!

lgessler 2020-09-25T19:31:22.030Z

it appears to me like one of my dynamic routers isn't properly composing initial state for a child component, anyone ever had this issue? i ought to be doing something wrong but i can't tell what--i print the props my component is getting initially in my render function and the kv pairs I have in :initial-state aren't present

Jakub Holý 2020-09-27T13:20:40.044400Z

@lgessler if you can think of better wording / further clarification for the relevant parts of the Book, please send a PR!

2👍
lgessler 2020-09-27T16:25:12.045Z

can't immediately think of what gave me this impression--maybe a warning box in one of the load sections or the dynamic routing section saying something like "hey if you had any other data on this ident it's gonna disappear after a load". i'll submit a PR if a good idea comes to me 🙂

xceno 2020-09-27T16:43:30.045300Z

> if you can think of better wording / further clarification for the relevant parts of the Book, please send a PR! I'm currently collecting all kinds of notes about fulcro, specifically "how to" examples and typical errors i run into while learning it on the go. Once I built up my collection I'll clean in up and translate it. I hope there's some stuff I can contribute back

1❤️
xceno 2020-09-25T20:26:13.030600Z

Well I just fought this issue for the last 5 hours and finally figured it out just this second. Let's take the RAD demo as basis: https://github.com/fulcrologic/fulcro-rad-demo/blob/master/src/shared/com/example/ui.cljc I have a component AnotherRoot in another namespace. This component has a nested, dynamic router. I have that router composed into AnotherRoot via :pre-merge as described in the docs. Then I added AnotherRoot to the MainRouters :Router-targets of the demo. I assumed this should be enough, since the MainRouter gets composed into the Root component, but apparently I was wrong. The nested router did work for simple routes without arguments, but throws an error for routes with arguments. What finally resolved it was also adding AnotherRouter to Root :query

xceno 2020-09-25T20:33:26.030900Z

Here's the code I'm describing: https://gist.github.com/Xceno/db47160674f4b2832479d700dee244e7

lgessler 2020-09-25T20:43:45.031100Z

what a coincidence! I'm trying to understand what's happening here, I assume the part you're referring to in the book is http://book.fulcrologic.com/#_initial_state_2 right?

lgessler 2020-09-25T20:44:09.031300Z

reading your code now... in my case I have RootRouter pointing to NestedRouter , and a FooComponent which isn't getting its initial state in props

lgessler 2020-09-25T20:44:20.031500Z

I don't have pre-merge on any of them, didn't realize it was necessary

lgessler 2020-09-25T21:41:05.031700Z

hm ok looks like my problem wasn't router related at all... so I have this component, for some reason it wasn't getting props with its initial state in it:

(defsc ProjectSettings [this {:project/keys [id name] :keys [active-tab] :as props}]
  {:query         [:project/id :project/name :active-tab]
   :ident         :project/id
   :initial-state {:active-tab "0"}
   :route-segment (r/last-route-segment :project-settings)
   :will-enter    (fn [app {:keys [id]}]
                    (dr/route-deferred
                      [:project/id (uuid id)]
                      #(df/load! app [:project/id (uuid id)] ProjectSettings
                                 {:post-mutation        `dr/target-ready
                                  :post-mutation-params {:target [:project/id (uuid id)]}})))}
I was able to make it work eventually by adding this:
:pre-merge     (fn [{:keys [data-tree] :as m}]
                    (merge (comp/get-initial-state ProjectSettings)
                           (fm/sweep data-tree)))
however, I don't entirely understand why this was necessary. (If it matters, this component's parent is a dynamic router.) Any ideas?

tony.kay 2020-09-25T22:58:31.031900Z

Pre-merge is part of the dynamic story….the fact that you’re loading the target is the issue. initial-state has nothing to do with loads…it is for the very first frame (instant) of your application’s lifetime. From there it has nothing to do with anything unless you explicitly call it. It’s called initial-state, but should probably have been called state-used-for-application-startup-only or something 🙂

1
tony.kay 2020-09-25T22:59:13.032100Z

Something has to make the initial database of your app (which is in the state-atom and is commonly referred to as the application state)…thus the name.

tony.kay 2020-09-25T22:59:51.032300Z

it has nothing to do with the initial state of anything else…if you loaded something, then obviously the data you loaded is the state of the thing, not the initial state.