Wednesday, April 9, 2025
1 change · 18.0
Code cleanup and technical improvements
This refactor changes how Odoo’s automated web tours detect page elements, making the process simpler and less dependent on timing assumptions. It should reduce inconsistent tour failures and make related issues easier to understand and resolve, with no intended direct change for end users.
Original PR description
In this commit, we're refactoring macro.js by completely changing its operation. To detect triggers in the DOM, we no longer rely on DOM mutations, but instead check for each frame to see if the trigger is in the DOM. Once the trigger is found, we perform the action and move on to the next step. This significantly simplifies understanding of how macro.js works, tours, and, more importantly, the bugs that can occur in tours. This also avoids many indeterministic errors that could occur in the tours due to the completely arbitrary "checkDelay" parameter (the time period after which there are no more mutations before the element is checked to see if it is in the DOM). This checkDelay parameter is therefore no longer used. It will be completely removed from the codebase in a future PR.