Skuid page not loading in lightning community component

I have a skuid page that I’m exposing via the Lighting Skuid Component within a lightning community. The page has inline javascript. It will not load.

If I remove the javascript, it will load. 

I have my Content Security Policy set to “Allow Inline Scripts and Script Access to Any Third-party Host”, and have generated support files for all pages (and even manually generated the support files for this page).

What am I missing to make this work?

Hi Brayden.

The long-story-short of the issue that LockerService in Lightning curbs the use of in-page JavaScript and similar resources for security purposes. 

If you’d like to stick to using in-line resources in your page, then you’ll need to utilize page support files (https://docs.skuid.com/latest/en/guide-dev/#in-line-resources-and-page-support-files). Each time you update your in-line resources you’ll need to regenerate your page support files for that page, if you don’t have the setting enabled to do so automatically (found in the “Configure” tab of the Skuid app).

However, note that this has some downsides because the generation of these support files counts as a Salesforce deployment.

The best practice here would be to include all of your custom code in static resource that you keep updated as your code changes, and then including that static resource within the Skuid page.

By doing this you avoid the issue of making sure your page support files are up-to-date and that you aren’t causing any deployment backlogs by working on your pages.

I see that you have tried to generate the page support files manually. In that case, do you see any errors in the browser’s Javascript console that you could share here?

If you’ve generated page support files for your inline scripts, and the page still doesn’t load with them in place, then some aspect of your inline script may not be Lockerservice compliant. In other words, the JS needs to be ‘strict.’ 

One common gotcha is that all variables need to be declared with var. In Classic Salesforce, you can set up a variable just by saying 

myVariable = "hello";

But in Lightning, you would need to say

var myVariable = "hello";