Announcement

Collapse
No announcement yet.
X
  • Filter
  • Time
Clear All
new posts

    JavaScript Error in Developer Console after successful remove operation

    Hello Isomorphic,

    I'm using SmartClient Version: v9.1p_2014-10-29 (FF26, Chrome 38).
    I get an error for following request. The JS error is different in Chrome and Firefox and might be related to my DMI that is executed. My DS is a view and on the database level I don't really DELETE FROM VIEW, but create an entry resulting in the requested row missing from the view. So I have to mock the remove-response in my DMI - perhaps I'm missing something here - nevertheless this should not result in a JS Error, I'd guess.

    In result, the browser keeps displaying the hourglass pointer and that tab becomes unresponsive.

    Developer Console: DSRequest
    Code:
    {
        dataSource:"V_LEAD_MATCHED_UNDISMISSED", 
        operationType:"remove", 
        operationId:"declineLead", 
        data:{
            USER_ID:1012, 
            LEAD_ID:35
        }, 
        textMatchStyle:"exact", 
        showPrompt:true, 
        oldValues:{
            USER_ID:1012, 
            LEAD_ID:35
        }, 
        requestId:"V_LEAD_MATCHED_UNDISMISSED$6278", 
        fallbackToEval:false, 
        lastClientEventThreadCode:"TMR9", 
        bypassCache:true
    }
    Developer Console: DSResponse
    Code:
    [
        {
            affectedRows:0, 
            data:[
                {
                    USER_ID:1012, 
                    LEAD_ID:35
                }
            ], 
            invalidateCache:false, 
            isDSResponse:true, 
            operationType:"remove", 
            queueStatus:0, 
            relatedUpdates:[
                {
                    affectedRows:1, 
                    dataSource:"T_LEAD_USERDISMISSED", 
                    isDSResponse:true, 
                    invalidateCache:false, 
                    status:0, 
                    operationType:"add", 
                    data:[
                        {
                            MODIFIED_AT:new Date(1414594005000), 
                            CREATED_BY:"1012", 
                            USER_ID:1012, 
                            CREATED_AT:new Date(1414594005000), 
                            LEAD_ID:35, 
                            ID:3, 
                            MODIFIED_BY:"1012", 
                            TENANT_ID:2
                        }
                    ]
                }
            ], 
            status:0
        }
    ]
    Developer Console (FF26): Error
    Code:
    15:46:45.820:XRP1:WARN:Log:TypeError: isc.DS.get(...) is null
    Stack from error.stack:
        DataSource._completeResponseProcessing() @ lms/sc/modules/ISC_DataBinding.js?isc_version=v9.1p_2014-10-29.js:731
        DataSource._handleSCServerReply() @ lms/sc/modules/ISC_DataBinding.js?isc_version=v9.1p_2014-10-29.js:2416
        [c]Class.fireCallback() @ lms/sc/modules/ISC_Core.js?isc_version=v9.1p_2014-10-29.js:283
        [c]Class.fireCallback() @ lms/sc/modules/ISC_Core.js?isc_version=v9.1p_2014-10-29.js:344
        anonymous() @ lms/sc/modules/ISC_DataBinding.js?isc_version=v9.1p_2014-10-29.js:1645
        init_3/$wnd.isc.RPCManager.fireReplyCallback() @ :3006
        [c]RPCManager.fireReplyCallbacks() @ lms/sc/modules/ISC_DataBinding.js?isc_version=v9.1p_2014-10-29.js:1652
        [c]RPCManager.performOperationReply() @ lms/sc/modules/ISC_DataBinding.js?isc_version=v9.1p_2014-10-29.js:1643
        RPCManager._performTransactionReply() @ lms/sc/modules/ISC_DataBinding.js?isc_version=v9.1p_2014-10-29.js:1623
        [c]RPCManager.performTransactionReply() @ lms/sc/modules/ISC_DataBinding.js?isc_version=v9.1p_2014-10-29.js:1540
        anonymous() @ lms/sc/modules/ISC_Core.js?isc_version=v9.1p_2014-10-29.js:74
        [c]Class.fireCallback() @ lms/sc/modules/ISC_Core.js?isc_version=v9.1p_2014-10-29.js:283
        [c]Comm.performXmlTransactionReply() @ lms/sc/modules/ISC_Core.js?isc_version=v9.1p_2014-10-29.js:1112
        anonymous() @ lms/sc/modules/ISC_Core.js?isc_version=v9.1p_2014-10-29.js:74
        [c]Class.fireCallback() @ lms/sc/modules/ISC_Core.js?isc_version=v9.1p_2014-10-29.js:283
        Comm._fireXMLCallback() @ lms/sc/modules/ISC_Core.js?isc_version=v9.1p_2014-10-29.js:1094
        Comm.sendXmlHttpRequest/_12() @ lms/sc/modules/ISC_Core.js?isc_version=v9.1p_2014-10-29.js:1099
    
    15:46:45.821:XRP1:WARN:Log:Uncaught JavaScript exception: TypeError: isc.DS.get(...) is null in http://localhost:8080/lms/lms/sc/modules/ISC_DataBinding.js?isc_version=v9.1p_2014-10-29.js, line 731
    Developer Console (Chrome 38): Error
    Code:
    15:55:03.517:XRP5:WARN:Log:TypeError: Cannot read property 'updateCaches' of null
    Stack from error.stack:
    	DataSource.completeResponseProcessing(<no args: exited>) @ ISC_DataBinding.js:731:44
    	DataSource.handleSCServerReply(<no args: exited>) @ ISC_DataBinding.js:2416:107
    	Class._fireCallback(_1=>"isc.Comm.performXmlTransactionReply(9, x..."[54], _2=>"xmlHttpRequest", _3=>Array[1], _4=>[object Window], _5=>true) @ ISC_Core.js:283:49
    	[a]RPCManager.fireCallback(<no args: exited>) @ ISC_Core.js:344:302
    	RPCManager._fireReplyCallback(<no args: exited>) @ ISC_DataBinding.js:1645:77
    	[c]RPCManager.fireReplyCallback(<no args: exited>) @ [no file]:3013:7110
    	RPCManager._fireReplyCallbacks(<no args: exited>) @ ISC_DataBinding.js:1652:120
    	RPCManager._performOperationReply(<no args: exited>) @ ISC_DataBinding.js:1643:13
    	RPCManager.__performTransactionReply(<no args: exited>) @ ISC_DataBinding.js:1623:6
    	RPCManager._performTransactionReply(<no args: exited>) @ ISC_DataBinding.js:1540:20
    DMI generating the response: (perhaps I'm missing something here?)
    Code:
    ....
    		// After moving lead to dismissed leads (for current user) and perhaps setting the lead to dismissed status, remove
    		// lead from
    		// V_LEAD_MATCHED_UNDISMISSED Cache for the current user
    		DSResponse removedFromPicklist = mockRemovedRecord(myLeadId, myUserId, dsRequest.getDataSource());
    		removedFromPicklist.addRelatedUpdate(addUserDismissedResponse);
    		return removedFromPicklist;
    	}
    
    	private DSResponse mockRemovedRecord(final long leadId, final long userId, final DataSource ds) {
    		DSResponse mockedResponse = new DSResponse(ds, DSResponse.STATUS_SUCCESS) {
    			{
    				setOperationType(DataSource.OP_REMOVE);
    				List<Map<String, Object>> recordList = new ArrayList<Map<String, Object>>();
    				Map<String, Object> record = new HashMap<String, Object>();
    				record.put("LEAD_ID", leadId);
    				record.put("USER_ID", userId);
    				recordList.add(record);
    				setData(recordList);
    			}
    		};
    		return mockedResponse;
    	}
    Do you need more information?

    Best regards,
    Blama

    #2
    This looks like on the client side there is no DataSource with the ID "T_LEAD_USERDISMISSED" - so the relatedUpdates block is failing.
    If you explicitly call isc.DataSource.get("T_LEAD_USERDISMISSED") - do you get anything back?
    If you remove the related update from the response does the bug go away?

    Also I think the affectedRows count should be 1, not zero, as one row was removed.

    Let us know if this doesn't help

    Regards
    Isomorphic Software

    Comment


      #3
      Hi Isomorphic,

      the missing DataSource was the reason for the exception, thanks a lot. I also changed the affectedRows to 1.

      As enhancement: Would it be possible to report such an error (receiving data for an unknown DS on the client) in the Developer Console instead of failing with an exception?
      Obviously the programmer is doing something wrong here, but with an error message one could find the reason for the error more easily.

      Best regards,
      Blama

      Comment


        #4
        Sure - that makes sense - we'll catch this case and add a warning to the logs.

        Comment

        Working...
        X