Fork me on GitHub
Brandon Olivier00:02:19

I’m new to Fulcro, so maybe I’m doing something wrong, but my graph has become disconnected and I’m not sure what’s the right way to reconnect it.

Brandon Olivier00:02:00

I added a new component into an existing hierarchy like

A -> B -> C
A -> b' -> B -> C
(in my case b' is a router) But my root query no longer works because B and C are getting disconnected

Brandon Olivier00:02:56

I’m also not confident I’m storing a list of items correctly. I have the list at [:component/id ::ListComponent :root/list]

Brandon Olivier00:02:25

I’m even more confused because I manually added the missing edge in the repl (or so I thought) and it’s not registering through the router.

Brandon Olivier00:02:46

So, I managed to resolve the issue, although I’m not totally clear on how this worked. I added :initial-state options down the tree to the components I was trying to manually add, and then since they existed in the graph, everything was traversable.

👆 1

most problems for beginners are making sure there is initial data in the db, which is always just that: Have an initial-state declaration on your components so that Fulcro can put them in your DB for you. If you don't list those, Fulcro expects you'll put them there some other way (e.g. loads)...which is then up to you during initialization


In the RAD demo, there’s this code to set up routes in the menu:

(ui-dropdown-menu {}
  (ui-dropdown-item {:onClick (fn [] (rroute/route-to! this InvoiceList {}))} "View All")
  (ui-dropdown-item {:onClick (fn [] (form/create! this InvoiceForm))} "New")
  (ui-dropdown-item {:onClick (fn [] (rroute/route-to! this AccountInvoices {:account/id (new-uuid 101)}))} "Invoices for Account 101")
  (ui-dropdown-item {:onClick (fn [] (rroute/route-to! this AccountInvoices {:account/id (new-uuid 102)}))} "Invoices for Account 102"))) ; <=== I added this
I added a new menu item for “Invoices for Account 102” — the problem is, if I show invoices for 101, and then select invoices for 102, the screen doesn’t update. I’m assuming it’s because the route is the same — is there a way to force Fulco to reload the report, to show the invoices for 102? (Not sure I’m even using the right language). THANK YOU!


Probably should be considered a bug. It isn't technically the same route because the parameters are different, but because you are not exiting and re-entering the route the state machine won't be told.


betting it works fine if you go out and back, you CAN manually call the code that the route event calls: form/start-form!, though you should probably also call the code that stops the old one. The real solution is for the routing to actually cause the exit/enter events itself 😄


See also form-will-leave and form-will-enter...that's the pair that normally runs from the router events


The use-case in your example is kind of a corner that almost no one will hit...when do you do explicit entity routing like was just a dumb example to show the methods could be called.


Mostly you'll go back to a report that lists them and pick a diff one, which will exit/enter and not cause issue


Thanks so much the hints here, @U0CKQ19AQ — Just to make sure I’m tracking: AccountInvoices is a report, not a form, correct? Do I still need to call form/start-form!? (Still hacking away on this, determined to get this to work. 🙂 And yes, a workaround is just to call another conventional report, which is “fine”. 🙂


I actually thought this would work, but it didn’t:

(report/report-will-enter this {:account/id (new-uuid 101)} AccountInvoices)
(rroute/route-to! this AccountInvoices {:account/id (new-uuid 101)}))


ah exercise. Look at the report ns for the helpers


route-to won't do anything because you're already there


but will-enter logic should do it


report has start-report!


Thx — will look at again later today!