mwbouwkamp-mendix / treeGraphWidgets

1 stars 0 forks source link

Source microflow is called over and over when showing Org Chart #14

Open roel-de-koning opened 5 months ago

roel-de-koning commented 5 months ago

Hello Marco,

First of all, the widget looks very nice in the sample app, perfect for what I need so thank you for creating it!

Unfortunately however, I am facing a blocking issue when trying to use it with my own data model: when showing the widget, the source microflow is called over and over, never ending so unfortunately, the widget never shows up.

Main difference with your data model that I can see is that my objects are not persisted: they are generated on the fly (they are read from a REST API call) and I would like to avoid persisting them if I can. Could this be an issue?

My data object looks like this (I hope inserting images by copy/paste works):

image

It does not seem to matter if I use the Instance Id (a unique number) or the name (also unique but free format string). I just added the _ID field because the documentation told me to do so but it does not (yet) have any value because I later saw how it was used in the widget settings and decided to use existing fields. I assume that, as long as I link the Name or Instance Id field in the widget settings, the _ID field is not used.

I have dragged the Org Chart onto my page into a Data View that provides the context for the nodes that are generated. The microflow takes one parameter (the object from the Data View) and builds a list of Hierarchy Objects from that:

image

The list of objects returned starts with the "root node" (which does not have a parent through the HierarchyObject_HierarchyObject relationship, and then goes on to list all objects linked to the root node (and the ones below those). As a test, I am restricting my data to 3 levels of Hierarchy Objects so the microflow ends pretty quickly and returns 9 items.

The log message I am generating shows that the microflow is called multiple times per second, every time with the same object.

Edit: I am using Mendix 10.4.1.

mwbouwkamp-mendix commented 2 months ago

Hi Roel, working with non-persisted entities should not pose a problem. Also, it does not matter what you use as a unique identifier. As long as it is unique. So, I am not sure what the problem could be. Are you sure that you are not refreshing e.g., your context object in your microflow as this could also result in a rerender.