2 Theme Versions | 1 Randomly Breaks on Reload (JavaScript)

Solved
Goldendust20
Excursionist
41 3 23

Hello everyone, I have an odd issue happening that I'm hoping someone has seen before and knows the solution.

 

We had our website optimized by someone we no longer have access to. Since the optimization we've noticed that our product page's JavaScript (specifically jQuery) randomly breaks the page and product images when the page is loaded/reloaded.

 

I have 2 versions of the theme from different dates. One is NOT optimization (and working without breaking) and one that IS optimized (but breaking jQuery randomly). 

 

Not Optimized but working properly (currently in production

https://www.leatherhoney.com/products/leather-honey-leather-conditioner

 

Optimized but NOT working (currently in development 

https://leather-honey-dev.myshopify.com/products/ready-to-use-leather-cleaner

 

Password: LHDEV

 

Note: I am able to reproduce the issue with the optimized version in development + production, and have also verified they the non-optimized version works correctly in both environments as well.

 

I've discovered when the optimized theme randomly breaks, this is the JavaScript error (attached). When it is not broken, this error is not present. I am showing the broken version on development simply to rule out any potential application conflicts.

 

  • The Development Environment does not have any applications installed.
  • I am not sure what theme this was originally built from (previous developer renamed the theme).

 

Here's a YouTube video I made where you can see the theme switching and reproducing the issue. The error is below.

https://youtu.be/sQdtkqEzeOw

 

If you know what could be causing this or what we can do to identify the issue, please let me know.

 

Thank you!

 

Non-Optimized Version that Loads Correctly (ignore errors about suspended account and optin monster):

NON-optimized-dev-version.jpg



 

Optimized Version that Randomly Breaks jQuery:

jquery-loading-order-error.jpg

Do Only Good Everyday
Accepted Solution (1)

Accepted Solutions
Goldendust20
Excursionist
41 3 23

This is an accepted solution.

Greetings! 

 

We were able to solve this on our end. Should you find yourself running into script oddities like this, make sure your jQuery scripts link isn't set to DEFER

Do Only Good Everyday

View solution in original post

Reply 1 (1)
Goldendust20
Excursionist
41 3 23

This is an accepted solution.

Greetings! 

 

We were able to solve this on our end. Should you find yourself running into script oddities like this, make sure your jQuery scripts link isn't set to DEFER

Do Only Good Everyday

View solution in original post