Title: Widget not showing; javascript errors
Last modified: August 12, 2024

---

# Widget not showing; javascript errors

 *  Resolved [hollowaysteve88](https://wordpress.org/support/users/hollowaysteve88/)
 * (@hollowaysteve88)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/widget-not-showing-javascript-errors/)
 * I recently noticed that the widget is intermittently not showing (plugin version
   1.2.13). I can’t find a clear pattern to reproduce it reliably, other than “it
   often fails on first page load in a new session but shows up on subsequent visits”.
   I see this on two different sites, one that has the pro add-on, and one that 
   does not. Neither site uses any CSS or JS optimization plugin.
 * Looking at the Javascript console, I see the following. First, there is a warning(
   embedded in the page, probably by a PHP script from woocommerce):
   _(index): Scripts
   that have a dependency on [wc-blocks-checkout] must be loaded in the footer, 
   wp-loyalty-rules-lite-main was registered to load in the header, but has been
   switched to load in the footer instead. See [https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/5059](https://github.com/woocommerce/woocommerce-gutenberg-products-block/pull/5059)
   _Second, there is an actual JS error. This is no doubt related to the issue, 
   because this error doesn’t show when the widget does load correctly._Error: Minified
   React error #299; visit [https://reactjs.org/docs/error-decoder.html?invariant=299](https://reactjs.org/docs/error-decoder.html?invariant=299)
   for the full message or use the non-minified dev environment for full errors 
   and additional helpful warnings.at t.createRoot (bundle.js?ver=1.2.13&t=1723441912:
   2:142694)at bundle.js?ver=1.2.13&t=1723441912:2:226205
 * The “bundle.js” mentioned above comes from wployalty/Js/dist/bundle.js so this
   is definitely related to wployalty plugin.

Viewing 5 replies - 1 through 5 (of 5 total)

 *  Thread Starter [hollowaysteve88](https://wordpress.org/support/users/hollowaysteve88/)
 * (@hollowaysteve88)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/widget-not-showing-javascript-errors/#post-17946784)
 * Regarding the [wc-blocks-checkout] warning, I’m not sure why it’s coming up on
   pages that have nothing to do with the checkout (e.g. the landing page). I do
   have a plugin that adds a side-cart widget which allows users to view their cart
   contents and proceed to checkout from the side cart pop-out.
 *  Plugin Support [akshayathangaraj](https://wordpress.org/support/users/akshayathangaraj/)
 * (@akshayathangaraj)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/widget-not-showing-javascript-errors/#post-17947562)
 * Hi,
 * Thank you for reaching out and providing detailed information about the issue.
 * Regarding the dependency warning related to `[wc-blocks-checkout]`, we’re aware
   of this and will be addressing it in the next release.
 * Secondly, for the JavaScript error, as we couldn’t reproduce it on our end, could
   you please help us by providing a screencast showing how the issue occurs? Additionally,
   it would be helpful to know the versions of PHP, WordPress, and WooCommerce you’re
   using.
 * Please submit this information by opening a support ticket using the following
   link: [WPLoyalty Support](https://wployalty.net/support/).
 * We’ll look into this promptly and assist you further.
 * Best regards,
   AkshayaWPLoyalty Support Team
 *  Thread Starter [hollowaysteve88](https://wordpress.org/support/users/hollowaysteve88/)
 * (@hollowaysteve88)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/widget-not-showing-javascript-errors/#post-17948447)
 * Actually, I think the root cause of the issue may be coming from this snippet.
   This is the final few lines of bundle.js file:
 * var Z = document.getElementById(“wll-site-launcher”);
   Z ? t.createRoot(Z).render(
   e.createElement(X, null)) : setTimeout((function() {Z = document.getElementById(“
   wll-site-launcher”);var n = t.createRoot(Z);Z && n.render(e.createElement(X, 
   null))}), **1e3**)
 * The above script attempts to create the widget via the ‘wll-site-launcher’ DOM
   element. But it may happen that the element is not yet created, so the script
   has a fallback where it defers this action by one second (1e3 milliseconds in
   the original code). On a slow site with a complex DOM (think elementor and lots
   of featured products on the home page), a one second delay is not enough, and
   the callback fails because the element it’s looking for is still not created.
   This is what I see in the error: the argument passed to createRoot() is in fact
   null.
 * I manually changed the timer to two seconds (2e3) and this seems to help on my
   sites, but this is not the right way to do it. The code should keep checking 
   for null and re-defer itself until the DOM is ready. Perhaps do this up to 10
   times, deferring another second each time, and then print an error message and
   fail gracefully. I’m not a JS developer so I can’t suggest anything better, sorry.
 *  Plugin Support [akshayathangaraj](https://wordpress.org/support/users/akshayathangaraj/)
 * (@akshayathangaraj)
 * [1 year, 9 months ago](https://wordpress.org/support/topic/widget-not-showing-javascript-errors/#post-17949087)
 * Hi,
 * Thank you for sharing these details!
 * We understand the issue you’re facing with the `wll-site-launcher` element not
   being created in time due to slow loading.
 * We’ll be addressing this in the next release to ensure the widget loads correctly
   even on slower sites.
 * Thanks for bringing this to our attention, and if you have any other questions
   or concerns, feel free to reach out!
 * Regards,
 * WPLoyalty Support Team.
 *  Plugin Support [haripradeepa](https://wordpress.org/support/users/haripradeepa/)
 * (@haripradeepa)
 * [1 year, 8 months ago](https://wordpress.org/support/topic/widget-not-showing-javascript-errors/#post-18057642)
 * Hi there,
 * Since we haven’t received a response, we’ll consider this issue resolved. If 
   you need further assistance or have any questions, feel free to reach out to 
   us.
 * Our support team is always here to help.
 * Thanks!

Viewing 5 replies - 1 through 5 (of 5 total)

The topic ‘Widget not showing; javascript errors’ is closed to new replies.

 * ![](https://ps.w.org/wployalty/assets/icon-128x128.gif?rev=2971238)
 * [Loyalty Points Rewards and Referral for WooCommerce - WPLoyalty](https://wordpress.org/plugins/wployalty/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/wployalty/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/wployalty/)
 * [Active Topics](https://wordpress.org/support/plugin/wployalty/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/wployalty/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/wployalty/reviews/)

## Tags

 * [widget](https://wordpress.org/support/topic-tag/widget/)

 * 5 replies
 * 3 participants
 * Last reply from: [haripradeepa](https://wordpress.org/support/users/haripradeepa/)
 * Last activity: [1 year, 8 months ago](https://wordpress.org/support/topic/widget-not-showing-javascript-errors/#post-18057642)
 * Status: resolved