Fix Uncaught TypeError: Cannot read properties of null (reading 'app_obj') when clicking a project title.

onclick for nextmatch rows was not getting re-parsed for each row, so it was trying with the original widget from the template instead of the one from the row.
Also accepting widget as argument into compiled legacy code and using it over original context so we don't need to re-compile for each row.
This commit is contained in:
nathan
2022-08-17 13:23:55 -06:00
parent 6caaba1bca
commit 40bbc53af8
3 changed files with 25 additions and 4 deletions

View File

@ -111,7 +111,8 @@ export function et2_compileLegacyJS(_code, _widget, _context)
// Execute the code and return its results, pass the egw instance and
// the widget
return function(ev) {
return function(ev, widget?)
{
// Dump the executed code for debugging
egw.debug('log', 'Executing legacy JS code: ', _code);
@ -120,7 +121,7 @@ export function et2_compileLegacyJS(_code, _widget, _context)
egw.debug('warn', 'Legacy JS code only supports 2 arguments (event and widget)', _code, arguments);
}
// Return the result of the called function
return func.call(context, ev, _widget);
return func.call(context, ev, widget || _widget);
};
}