• Resolved hollowaysteve88

    (@hollowaysteve88)


    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

    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 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

      (@hollowaysteve88)

      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

      (@akshayathangaraj)

      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.

      We’ll look into this promptly and assist you further.

      Best regards,
      Akshaya
      WPLoyalty Support Team

      Thread Starter hollowaysteve88

      (@hollowaysteve88)

      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

      (@akshayathangaraj)

      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

      (@haripradeepa)

      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)
    • You must be logged in to reply to this topic.