Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JS scripts not loading synchronously #152

Open
SathishSuresh-opex opened this issue Nov 22, 2022 · 2 comments
Open

JS scripts not loading synchronously #152

SathishSuresh-opex opened this issue Nov 22, 2022 · 2 comments

Comments

@SathishSuresh-opex
Copy link

SathishSuresh-opex commented Nov 22, 2022

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 ?

@Bohdan079
Copy link

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 ?

@nikolalsvk
Copy link
Owner

Are you also using Turbo or Turbolinks in the project? Here's how to configure it if you are:

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants