CustomString Error - Part 2

0
This question is related to my previous one, available here I have a list view within a data view. Each line item in the list gives acces to the user to a bunch of attributes of the object it displays. There is also a CustomString widget (the one that reads “Test text 1”) and a delete button that allows the user to delete the line item altogether. When the delete button is hit, the CustomString widget is deleted also, but somehow the Microflow that feeds it fires up again in a last swan’s song. I believe that, since there isn’t any target widget anymore for the output of the microflow, this generates a system error. But after that the list view is refreshed and all is well again. So the error needs to be simply disregarded. In other words:  “Dear System, if you catch an error from the CustomString widget that says  Cannot read property 'getGuid' of null TypeError: Cannot read property 'getGuid' of null please ignore it and do nothing. Don’t even display the ”Error: An error occured, please contact your system administrator” popUp on top of the UI in the browser. Yours truly, The App” How can this be done? P.S. I am pasting the complete error log here again, as seen in the other question.   Log node: Client Cannot read property 'getGuid' of null TypeError: Cannot read property 'getGuid' of null at E.(anonymous function).O._updateRendering (http://localhost:8080/widgets/CustomString/widget/CustomString.js?636868461336445956:73:53) at E.(anonymous function).O.<anonymous> (http://localhost:8080/widgets/CustomString/widget/CustomString.js?636868461336445956:115:30) at E.(anonymous function).O.<anonymous> (http://localhost:8080/mxclientsystem/mxui/mxui.js?636868461336445956:5:26632) at E.(anonymous function).O._runSubscription (http://localhost:8080/mxclientsystem/mxui/mxui.js?636868461336445956:36:62988) at E.(anonymous function).O.e.callback.e.val.n.callback (http://localhost:8080/mxclientsystem/mxui/mxui.js?636868461336445956:36:62398) at Object.callback (http://localhost:8080/mxclientsystem/mxui/mxui.js?636868461336445956:67:163463) at http://localhost:8080/mxclientsystem/mxui/mxui.js?636868461336445956:67:164899 at new Promise (<anonymous>) at http://localhost:8080/mxclientsystem/mxui/mxui.js?636868461336445956:67:164815 at Array.map (<anonymous>)  
asked
2 answers
3

Could you test this version for me?

https://github.com/mendix/CustomString/raw/bugfix/mssing_object/dist/CustomString.mpk

Should have a null check in there. My guess is that the update method is somehow triggered when you delete the object, which in turn creates this issue. The version here should fix that issue. If so, I'll create an update for the App Store.

answered
0

This is most likely an issue in the widget itself, probably a missing null check for _contextObject around line 73

_updateRendering : function (callback)\
{
         logger.debug(this.id + "._updateRendering");
         mx.ui.action(this.sourceMF, {
           params: {
               applyto     : "selection",
               guids       : [this._contextObj.getGuid()] //MISSING NULL CHECK
           },
          callback     : lang.hitch(this, this._processSourceMFCallback, callback),
            error        : lang.hitch(this, function(error) {
                alert(error.description);
                 this._executeCallback(callback, "_updateRendering error");
             }),
             onValidation : lang.hitch(this, function(validations) {
                 alert("There were " + validations.length + " validation errors");
                 this._executeCallback(callback, "_updateRendering onValidation");
             })
         }, this);
 },

AFAIK there is no way to prevent this error without changing the widget source code. Since this is not a Mendix platform widget try submitting an issue about it in Github – https://github.com/mendix/CustomString/issues

-Andrej

answered