Web Resource is not loading correctly

Hi Experts,

I am using a web resource module in my plugin which was working fine with Jira 8. x.x. When I tested with Jira 9 it is not working correctly. It seems my xyz.js file is executing partially or before the page loads.

Note: My xyz.js file needs to execute on jira.view.issue page after page loads.

atlassian-plugin.xml

 <web-resource key="xyz-resources-issue-view-${project.version}" name="Xyz View Web Resources">
		    <resource type="download" name="issue_view_xyz.js" location="/js/issue_view_xyz.js"/>  
		    <context>jira.view.issue</context>
</web-resource>

Hi @dchouksey89 i’m having the same problem. The web resources are loading even if the condition attached result is false.

There is a workaround that not involves to check the condition from javascript?

Thanks!

We execute our JS code using AJS.toInit, not sure if there is a better way. In addition you may need to check if AJS?.toInit is even a function and make a timeout otherwise.

if (typeof window.AJS?.toInit === 'function') {
	return window.AJS.toInit(() => yourInitMethod());
}
...
code to wait for toInit to be present