Skip to content

[Bug] Access Log refresh button does not reset countdown timer — appears non-functional #153

@parhumm

Description

@parhumm

Problem Description

The refresh button (circular arrows icon) in the Access Log box header triggers an AJAX data reload, but the countdown timer is not reset afterward. This makes the refresh appear completely non-functional — the user sees a flash animation but no visible confirmation that data was refreshed. Combined with unchanged data (when no new pageviews occurred), the button feels "fake."

Impact

Users lose trust in the manual refresh feature and must wait for the full auto-refresh cycle (up to 60 seconds) even after clicking refresh. This creates a poor UX experience on the Access Log page (slimview1).

Steps to Reproduce

  1. Navigate to Slimstat → Access Log (slimview1)
  2. Wait for the countdown timer to reach ~30 seconds remaining
  3. Click the refresh button (circular arrows icon) in the Access Log box header
  4. Observe the content flash (fadeOut/fadeIn animation plays)
  5. Check the countdown timer

Expected Behavior

  • Data reloads via AJAX ✓ (this part works)
  • Countdown timer resets to indicate a fresh refresh cycle just completed ✗ (broken)

Actual Behavior

  • The fadeOut/fadeIn animation plays, confirming the AJAX call succeeds
  • The countdown timer continues unchanged from where it was — no reset
  • If no new pageviews occurred since last load, data looks identical
  • Combined effect: the refresh appears completely non-functional
  • The auto-refresh at the next minute boundary (:00) works correctly

Root Cause Analysis

  1. Dead code at admin/assets/js/admin.js:1449: After a successful AJAX refresh of slim_p7_02, the code sets SlimStatAdmin._refresh_timer = SlimStatAdminParams.refresh_interval — but this property is never read anywhere in the codebase. It's a vestige of old logic that was never connected to the new clock-synced countdown.

  2. Clock-locked countdown at admin/assets/js/admin.js:1464-1479: The slimstat_sync_and_countdown() function always calculates remaining = (60 - currentSeconds) % 60, which is purely wall-clock based. There is no mechanism to account for a manual refresh having just occurred.

  3. Minor: clearTimeout on setInterval handle at line 1396: Uses clearTimeout() to clear a handle created with setInterval() (lines 1550/1567). Works in browsers due to shared ID pool, but should use clearInterval() for correctness.

Suggested Fix

After a manual refresh completes successfully, either:

  • Briefly show "0:00" or "Just refreshed" in the timer, then resume the clock-synced countdown
  • Or dispatch slimstat:minute_pulse to force a full refresh cycle reset
  • Remove the dead _refresh_timer property assignment

Code References

File Lines Description
admin/assets/js/admin.js 437-460 Click handler for .refresh buttons — triggers refresh_report()
admin/assets/js/admin.js 1387-1458 refresh_report() — AJAX logic that fetches fresh data (works correctly)
admin/assets/js/admin.js 1449 Dead code: _refresh_timer set but never read anywhere
admin/assets/js/admin.js 1461-1570 access_log_count_down() — clock-synced timer, ignores manual refresh
admin/assets/js/admin.js 1396 clearTimeout() used on a setInterval() handle
admin/view/wp-slimstat-reports.php 992 Header refresh button rendering with noslimstat refresh classes
admin/view/wp-slimstat-reports.php 1057-1058 Countdown timer <i class="refresh-timer"> rendering in pagination

Environment

Field Value
Tech Stack WordPress / PHP
WP Slimstat 5.4.1
OS Darwin 25.1.0 arm64
Branch development

Additional Context

The auto-refresh (triggered by slimstat:minute_pulse at every minute boundary) works correctly and uses the same refresh_report() function. The issue is purely a UX feedback gap — the manual refresh does reload data, but provides no visual confirmation to the user.


Reported via: qa-issue-report skill (jaan.to plugin)

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions