fulcro

Kevin Olson 2025-03-08T21:49:17.836409Z

When RAD report rendering with multimethods I'm running into a weird case.

(defmethod rr/render-report [:meeting/id :default-mm] [this options]
  (let [props (comp/props this)
        _ (tap> props)]

       (dom/div :.ui.container nil
                (rr/render-controls this options)
                (rr/render-body this options))))
The first render after I route to the report I get props from the report I am coming from. The odd thing is that the ro/row-pk for that report is :participant/id not :meeting/id. Subsequent renders contain the right props. It only happens when I come from a page that has a report/form combo that follows the master/detail pattern from the rad-demo code - which means I am doing the report rendering manually. Basically doing what you see https://github.com/fulcrologic/fulcro-rad-demo/blob/new-rendering/src/shared/com/example/ui/master_detail.cljc#L184. (can now reproduce multiple ways, see thread...) As you might expect I get the react warning Warning: Encountered two children with the same key, [:meeting/id nil]` because there aren't any meetings in the props. I'm sure it is something I am doing wrong but I'll post a pic in reply too just in case anyone else has seen it.

Kevin Olson 2025-03-08T21:49:43.054759Z

Kevin Olson 2025-03-08T23:38:34.775089Z

The other oddity is I've only ever seen this in Safari (mobile and desktop) so the mystery continues. I'll try running a "release" version from the uberjar now.

Kevin Olson 2025-03-09T00:11:43.192109Z

as an aside I confirmed that running report/clear-report! on the old report before routing to the new report does prevent the issue, e.g. (report/clear-report! this ParticipantList)

Kevin Olson 2025-03-09T17:00:40.751899Z

Getting closer ... I can reproduce it in the fulcro-rad-demo project too (new-rendering branch). If I comment out rro/style in InventoryReport I don't get the blank rows or error you see in the screenshot below. I'll keep digging.

Kevin Olson 2025-03-09T17:00:45.227159Z

Kevin Olson 2025-03-09T18:58:55.615889Z

Still working at it but I got it to fail another way ... if I just go back and forth between the Account -> View All and Inventory -> View All reports I can get it to happen too.

Kevin Olson 2025-03-09T19:39:10.491219Z

Ok will have to test this out later but if seems if I wrap my individual rows like com.fulcrologic.rad.rendering.semantic_ui.report/TableReportLayout does then it works. So the component hierarchy looks like this:

Kevin Olson 2025-03-09T19:39:57.158889Z

Instead of this:

Kevin Olson 2025-03-09T19:41:11.671469Z

I'm still a bit at a loss on root cause ... I suppose it is something I don't understand about react, but I'll let you know if I figure it out.

Kevin Olson 2025-03-10T20:38:32.982159Z

I guess the thing to remember is that you should always use BodyItem for rendering the rows. FWIW, I did notice that offending blank rows are rendered somewhere during the uism/load in c.f.r.report/load-report!. As in, the render that causes the blank rows and a render for the right rows happen before the :event/loaded handler fires ... then one more render happens with the right rows. I guess my laziness led me to just figure that the :keyfn for TableRowLayout in the fulcro-rad-demo was sufficient to prevent this sort of thing - or could be I'm just missing some obvious still.

Kevin Olson 2025-03-21T18:26:01.581979Z

0:35 and 0:46 of this video show the blank rows. Other than a small datomic deps change it is the stock fulcro-rad-demo new rendering branch. https://youtu.be/SByeZmzpPcc