Javascript: microflow calls from widget > 2

1
Hi i got a problem with calling microflows.   I'm doing the following.   for every object in list (lets say 4 items) - mx.data.action with callback function -> my microflow creates an object and returns it   if i place a breakpoint in my microflow i will see that it is only triggered twice. - I'm only seeing 2 xas/ request in my chrome network tab   my callback function is called 4 times. 1st callback (object from first microflow) 2nd callback (object from second microflow) 3rd callback (object from second microflow) 4th callback (object from second microflow   note: I'm passing 4 times the same microflow, guid and callback function (method call:  this._execMf(this.mfToExecute, this._contextObj.getGuid(), (objects)=>{ //do something});   Does somebody know what I'm doing wrong?
asked
4 answers
1

I've tested the following and i still get the same result

 

The github project can be found at https://github.com/JAM-IT-NL/JamUploadIt

answered
1

Your sample is not complete but with some work I manage to reproduce.

see https://github.com/JAM-IT-NL/JamUploadIt/pull/1

The output of the logging says the the platform intentionally skipped it.

JamUploadIt_widget_JamUploadIt_0._execMf4222124650660143
JamUploadIt_widget_JamUploadIt_0._execMf4222124650660143
JamUploadIt_widget_JamUploadIt_0._execMf4222124650660143
mendix.sys.Server.doRequest: skipping request: {"action":"executeaction","params":{"actionname":"TestSuite.CreateMF","applyto":"selection","guids":["4222124650660143"]},"changes":{},"objects":[{"objectType":"TestSuite.Color","guid":"4222124650660143","hash":"08KJmIPIlyr4p+GuZ1piHsE3FfdroSnRyPzA3A3nRhY=","attributes":{"TestSuite.files":{"value":[]},"IsPrimary":{"value":false},"RAL":{"value":2003},"ColorCode":{"value":"#FF7514"},"Name":{"value":"Pastel orange"}}}],"context":[]}
JamUploadIt_widget_JamUploadIt_0._execMf4222124650660143
mendix.sys.Server.doRequest: skipping request: {"action":"executeaction","params":{"actionname":"TestSuite.CreateMF","applyto":"selection","guids":["4222124650660143"]},"changes":{},"objects":[{"objectType":"TestSuite.Color","guid":"4222124650660143","hash":"08KJmIPIlyr4p+GuZ1piHsE3FfdroSnRyPzA3A3nRhY=","attributes":{"TestSuite.files":{"value":[]},"IsPrimary":{"value":false},"RAL":{"value":2003},"ColorCode":{"value":"#FF7514"},"Name":{"value":"Pastel orange"}}}],"context":[]}
mxui_widget_DataGrid_0.setUpdateInterval
mendix.sys.Data.getBacktrack
mendix.sys.Data.getBacktrack: zero paths for backtracking, aborting
mendix.sys.Server: loadHandler: received POST response  5
JamUploadIt_widget_JamUploadIt_0.resize
mendix.sys.Server: loadHandler: received POST response  2
mendix.sys.Server: loadHandler: received POST response  3
mendix.sys.Server: loadHandler: received POST response  4
mendix.sys.Data.sendValidationUpdates:0
Call 2: 5066549580792013
Call 3: 5066549580792013
Call 4: 5066549580792013
mendix.sys.Server: loadHandler: received POST response  1
mendix.sys.Data.sendValidationUpdates:0
Call 1: 5066549580792014
mendix.sys.Server: loadHandler: received POST response  6

I don`t think this is right. It looks like a platform optimization is incorrect. Please file a ticket, if you don't have any yet.

I do think you could try to force update, by changing a 'fake' attribute with a new random value every time you call the MF. That could probably prevent the cashing.

Though this work around is not perfect, it should be fixed in the the platform, or the API has to be extended to prevent caching somehow.

 

Cheers, Andries

 

Update: This issue is know to R&D, Please contact Mendix support for details and planning.

An alternative way might be calling using https://apidocs.mendix.com/7/client/mx.server.html#.request with the `options.unique: true` flag

 

 

answered
1

Dear Hong Wei Yang

Please check the release note of the Mendix 7.6

I do think this is related to your call

https://docs.mendix.com/releasenotes/desktop-modeler/7.6

You could give it an other try on the latest release.

 

Cheers Andries

answered
0

I dont see any mistakes in the code you shared.

Please not that you might need to bind the scope of the  callback. 


callback: lang.hitch(this, function (objs) {
    if (cb && typeof cb === "function") {
        cb(objs);
    }
}),

Soure: https://github.com/mendix/AppStoreWidgetBoilerplate/blob/master/src/WidgetName/widget/WidgetName.js#L149

If this does not help, please share the full code (via github), and I well have a check.

 

answered