Skip to content

fix(webui): reload history immediately when a filter is applied/cleared - #121

Merged
madejackson merged 1 commit into
mainfrom
fix/sniffer-history-filter-initial-load
Oct 18, 2026
Merged

madejackson merged 1 commit into
mainfrom
fix/sniffer-history-filter-initial-load

Conversation

@madejackson

Copy link
Copy Markdown

Problem

Applying a column filter (custom value or checkbox) in the History tab showed far fewer lines than the next live refresh added moments later — as if the first filter load was missing rows.

Root cause: applySnifferCustomFilter() and the checkbox handler in openSnifferFilterPopup() only called snifferRefreshRender() — a client-side re-filter of the already-loaded rows. The history table initially loads only the current page (limit = page size, e.g. 100). So the first filter application filtered those 100 rows locally and did not hit the server. Only on the next SSE/poll tick did snifferRefresh() fire snifferLoadHistory() — and that request, seeing the now-active filter, used limit=20000 without offset, suddenly showing hundreds of matching lines that "were missing" on first filter.

Fix

applySnifferCustomFilter() and the checkbox toggle handler now detect the History table and:

  • reset snifferHistoryPage = 1,
  • call snifferLoadHistory() immediately (fetch the full 20000-window server-side with the filter pushed to slaveid/address params where applicable).

clearSnifferFilter() gets the same treatment. The time-range filter already did this — these two paths now behave identically.

Verification (Playwright, mocked server with 600 rows / 2 slaves)

Request log before fix: history/flat?busid=0&limit=100&offset=0 only — the checkbox click produced no new request.
After fix:

history/flat?busid=0&limit=100&offset=0        (initial tab load)
history/flat?busid=0&slaveid=5&limit=20000     (immediately after checkbox click)

The full matching window is fetched right away, so the visible count on first filter equals what later live refreshes show.

When a column filter (custom value or checkbox) is applied or cleared in
the History tab, the code only re-rendered the already-loaded rows
(snifferRefreshRender). The first filter application therefore showed far
fewer lines than the next live refresh: the small initial page (limit =
page size, e.g. 100) was only filtered client-side, and the large
20000-row window was only fetched on the next SSE/poll tick — suddenly
adding many lines the user never saw on first filter.

Apply/clear now reset to page 1 and call snifferLoadHistory() for the
history table, so the full server window is fetched immediately. The
time-range filter already did this; custom-value and checkbox filters now
behave the same.

Verified with Playwright: applying a checkbox filter issues an immediate
/history/flat?slaveid=5&limit=20000 request (was: no request at all until
the next live tick).
@madejackson
madejackson merged commit 6f6cf0e into main Oct 18, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant