• Resolved Gisèle Wendl

    (@giselewendl)


    Hi Alex, I have a problem with the “reload data from server”-button on view balance and deposit.
    On normal page loads, it doesn’t trigger the reload on click (nor after load of the page).

    I see the functions in the data-bind/click, they do trigger on click, but there’s no ajax request after that.
    Now when I load the page with CTRL F5 (total reload) then the “reload data from server”-button works with no problem.
    It’s wallets 4.4.7. and I tried almost everything, like turning off all possible caches – I can do what I want, it doesn’t work on normal page loads, but it works when the page is loaded with CTRL F5.
    What to do? Thanks.

Viewing 7 replies - 1 through 7 (of 7 total)
  • Plugin Author dashed-slug.net

    (@dashedslug)

    Hello Gisele,

    Here’s a few things:

    1. Are there any JavaScript errors in your browser’s console? If an error occurs, not right after page load, but shortly after, this would explain the behavior you see. The knockout library doesn’t like JS errors.

    2. A long shot, but are you minifying your HTML markup? This can cause issues, because the plugin is using some knockout directives that are embedded in HTML comments.

    3. If you like, you could give me access, so I can login and debug this. I do not believe that admin access is required, a normal user account with the has_wallets capability should do. If you want me to do this, please contact me over email with credentials.

    with regards

    Thread Starter Gisèle Wendl

    (@giselewendl)

    Hello Alex

    1 + 2 don’t seem to apply -> I go for 3 ??
    cy soon

    Kind regards

    Plugin Author dashed-slug.net

    (@dashedslug)

    Thank you.

    I have logged in to your site.

    You have developed your own knockout.js views, and these have errors which prevent them from working as expected.

    I will contact you over email about this, to discuss how the ko bindings can be improved.

    with regards,
    Alex

    Thread Starter Gisèle Wendl

    (@giselewendl)

    We exchanged some e-mails in the past few hours, we found that it’s a caching issue and found plugin Super-PWA to be the cause of our problem.

    Super-PWA runs a service worker that caches xhr-requests locally.
    The service worker is a JS-file Super-PWA drops on the website root on activate.
    Its name is superpwa-sw.js.

    This file, on line 12, includes a constant which defines URLs that Super-PWA must never cache.

    I changed this line from it’s default
    const neverCacheUrls = [/\/wp-admin/,/\/wp-login/,/preview=true/];
    to
    const neverCacheUrls = [/\/wp-admin/,/\/wp-login/,/preview=true/,/__wallets_action=/];

    It adds all URLs containing pattern “__wallets_action=” to these URLs that Super-PWA will never cache.

    Super-PWA proposes the use of a filter to achieve the same result:
    apply_filters( 'superpwa_sw_never_cache_urls', '/\/wp-admin/,/\/wp-login/,/preview=true/,/__wallets_action=/' );

    In my tests, this filter did not change the excluded URLs, but changing the JS-file was successful – immediately, on next normal page reload, the ko-scripts worked again like intended.

    Alex, thanks again for your time-invest and for spotlighting the (cached) xhr-requests.

    Plugin Author dashed-slug.net

    (@dashedslug)

    Normally I should be the one who summarised the findings here, but again thanks for taking the time to do so!

    While you may have found a temporary workaround, I will continue to investigate this to find a more permanent solution.

    with regards

    Plugin Author dashed-slug.net

    (@dashedslug)

    After some digging, it turns out that the filter works, as long as you call superpwa_generate_sw(); once, right after providing the filter in functions.php. The call does not need to be called every time, only once and then the generated js code works.

    Even the code that does caching is cached ??

    I will be including a fix in the next release of wallets.

    Plugin Author dashed-slug.net

    (@dashedslug)

    The latest version 4.4.8 includes a fix for @superpwa compatibility, based on the above discussion.

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Reload data from server’ is closed to new replies.