domNode error

3
I am encountering the following error when trying to execute one or more microflows within a request page of my Mendix app.   An error occurred while executing an action of MyApp_Main.WF_UserTaskPage.actionButton1: Cannot read properties of undefined (reading 'domNode') Error: An error occurred while executing an action of MyApp_Main.WF_UserTaskPage.actionButton1: Cannot read properties of undefined (reading 'domNode')    at http://localhost:8010/mxclientsystem/mxui/mxui.js?638442813293584153:66:183385    at ye (http://localhost:8010/mxclientsystem/mxui/mxui.js?638442813293584153:24:6830)    at i (http://localhost:8010/mxclientsystem/mxui/mxui.js?638442813293584153:24:6731)    at O (http://localhost:8010/mxclientsystem/mxui/mxui.js?638442813293584153:64:5079)   By debugging, the error is occurring on the end event of the microflows. There don't seem to be any logic-related errors, and the attributes and associations of the involved entities appear to be correct. Even after refreshing the context or closing and reopening the Mendix page, the problem continues to persist.   The problem is resolved by refreshing (or closing and reopening) the browser page, but only for the specific request in question. A new request will have the same problem until the browser page is refreshed.   Any idea? Thanks
asked
1 answers
1

This error typically indicates an issue with the client-side state or interaction with the Mendix client API, especially concerning the handling of DOM elements within custom widgets or JavaScript actions.

Given your description, the problem seems to be related to the lifecycle of a DOM element accessed by a Mendix widget or a custom JavaScript/TypeScript action within your page.

Here are steps to diagnose and potentially resolve the issue:

  1. Verify Custom Widgets and JavaScript Actions: Check if the microflow in question is triggering any custom widgets or JavaScript actions that interact with the DOM. The error message suggests that a DOM element (domNode) expected to be present is not found. This often happens when custom code tries to access an element before it's fully initialized or after it's been destroyed.

  2. Review Widget Initialization and Cleanup: Ensure that any custom widget or JavaScript code properly handles the lifecycle of DOM elements. Widgets should only attempt to access DOM elements in the postCreate lifecycle method (or equivalent for your widget framework) and should clean up any references in the uninitialize method to prevent memory leaks and errors when elements are no longer present.

  3. Context Refresh Handling: If the error occurs after a context refresh, ensure that custom code listens for and correctly handles Mendix context updates. Widgets and actions that rely on context data should update their state and DOM elements accordingly.

  4. Debugging Tips:

    • Use browser developer tools to set breakpoints in your custom widgets or JavaScript actions to trace the execution flow and identify where the undefined reference occurs.
    • Temporarily disable custom widgets or JavaScript actions one by one to isolate the cause of the issue.
  5. Update Mendix and Widgets: Ensure your Mendix application and all custom widgets or third-party widgets are up to date. Sometimes, issues like these are resolved in newer versions of the Mendix platform or the widgets themselves.

answered