JS scripts not loading synchronously
I have html.erb file, loading two scripts .
<script type='text/javascript' src='https://service.force.com/embeddedservice/5.0/esw.min.js'></script>
<script type='text/javascript'>
console.log("window.embedded_svc...", window.embedded_svc);
</script>
embedded_svc is part esw.min.js file. I expect window.embedded_svc print object, but it's undefined.
This issue occurs only when I use render_async , it works well with regular render
Note - I have added in initializers
RenderAsync.configure do |config|
config.jquery = true # This will render jQuery code, and skip Vanilla JS code. The default value is false.
end
Why script is not loading synchronously ?
I have html.erb file, loading two scripts .
<script type='text/javascript' src='https://service.force.com/embeddedservice/5.0/esw.min.js'></script> <script type='text/javascript'> console.log("window.embedded_svc...", window.embedded_svc); </script>embedded_svc is part esw.min.js file. I expect
window.embedded_svcprint object, but it's undefined.This issue occurs only when I use
render_async, it works well with regular render Note - I have added in initializersRenderAsync.configure do |config| config.jquery = true # This will render jQuery code, and skip Vanilla JS code. The default value is false. endWhy script is not loading synchronously ?
Are you also using Turbo or Turbolinks in the project? Here's how to configure it if you are: