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.
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.
@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.
strange…not sure how that happened
that's a really good talk!
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
@lgessler if you can think of better wording / further clarification for the relevant parts of the Book, please send a PR!
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 🙂
> 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
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
Here's the code I'm describing: https://gist.github.com/Xceno/db47160674f4b2832479d700dee244e7
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?
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
I don't have pre-merge on any of them, didn't realize it was necessary
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?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 🙂
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.
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.