[SalesForce] not firing afterScriptsLoaded with Locker Service enabled

I am having an issue where the afterScriptsLoaded event is simply not firing on my <ltng:require /> component when I enable Locker Service. If that is calling a controller function that only does console.log('In After Loaded');, that log will never appear in the console despite all the scripts showing in the resources pane. If I disable Locker Service it shows right up as expected.

Has anyone else experienced this and more importantly, does anyone know a workaround?

Best Answer

The cases where we have seen this have all tracked back to the code being loaded failing to compile or execute because it either violates Locker (actually this has been rare) or it encounters classes, methods etc that are not currently exposed in Locker (almost 100% of the time). The afterScriptsLoaded= only runs if the code gets past compiling. If you have the browser's dev tools open and configured to break on all exceptions it should pinpoint the specific issue. Please let us know what you find. What libraries are you loading?

The good news is that we've spent the past 3 months working on a significant update to Locker that is scheduled to deploy to Winter'17 orgs on or near 10/18 and this set of fixes addressses almost all open cases/bugs.

Related Topic