EDSM-NET / FrontEnd

Issues tracker for EDSM
https://www.edsm.net/
37 stars 0 forks source link

EDSM Dashboard refresh can get stuck. #413

Closed Tenzian closed 3 years ago

Tenzian commented 3 years ago

Occasionally the dashboard timer will get stuck & forces you to manually refresh the page.

It looks like the code to reset the timer is only called if there's a successful get() request from dashboard/index/live:

    $(document).ready(function() {
        $('#dashboardLiveTimer').timer({
            duration: '10s',
            callback: function() {
                $('#dashboardLiveTimer').parent().hide();
                $('#dashboardLiveLoading').show();

                $.get("/en_GB/dashboard/index/live", function(data) {
                    $('#homeDashboard').html(data);
                    $('#dashboardLiveLoading').hide();
                    $('#dashboardLiveTimer').parent().show();

                    $('#dashboardLiveTimer').timer('reset');
                });
            },
            countdown: true
        });
    });

I think that if the get() doesn't return data, the timer reset is not getting called.

Looks like it needs an action to reset the timer in case of a failure or timeout.

Tenzian commented 3 years ago

For clarification, this isn't the scenario where the dashboard isn't the current tab so the timer's been carrying on unattended and giving you a garbage value when you return.

In this scenario, the dashboard has been the active tab all along, the timer becomes hidden and the loading icon is present permanently instead.

klightspeed commented 3 years ago

Call $('#dashboardLiveTimer').timer('reset'); within a .always(function(){}) on the promise returned by $.get()?

i.e.

                $.get("/en_GB/dashboard/index/live", function(data) {
                    $('#homeDashboard').html(data);
                }).always(function(){
                    $('#dashboardLiveLoading').hide();
                    $('#dashboardLiveTimer').parent().show();
                    $('#dashboardLiveTimer').timer('reset');
                });
Tonyindahouse commented 3 years ago

I have this issue too. It happens about 30% of the time.

AnthorNet commented 3 years ago

Should be fixed