From c288fc73a774f883eb22dc024af1575b2c8b0f97 Mon Sep 17 00:00:00 2001 From: poslop Date: Wed, 9 Sep 2026 09:13:40 -0500 Subject: [PATCH] Search: spinner indicator + performance note on client-side filtering (#32) - Fix filter fetch to request limit=100 (API max) instead of 500, which the API silently clamped, so filtered results actually cover the fetch window. - Document client-side filtering behavior and limits in README Performance Notes. --- README.md | 10 ++++++++++ internal/web/static/table.js | 2 +- 2 files changed, 11 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index a8d9126..05548cf 100644 --- a/README.md +++ b/README.md @@ -79,6 +79,16 @@ curl -X POST http://localhost:8080/api/pastes \ Full API docs: [docs/API.md](docs/API.md). +## Performance Notes + +The history and Saved pages use client-side filtering: when you type in the +search box, the UI fetches the most recent 100 pastes (`limit=100`, the API +maximum) once per query and filters/sorts them in the browser. Pastes beyond +the newest 100 are not searched; a match count against the full total is still +shown. This keeps search instant without a server-side query. If large +instances need full search later, it will be a server-side endpoint (see +issue #32). + ## CI Gitea Actions workflow at `.gitea/workflows/ci.yml`: diff --git a/internal/web/static/table.js b/internal/web/static/table.js index 971114c..7824080 100644 --- a/internal/web/static/table.js +++ b/internal/web/static/table.js @@ -63,7 +63,7 @@ const PaletteTable = (() => { const filtered = state.filter.length > 0; const off = (state.page - 1) * opts.perPage; const url = (filtered || state.sortKey) - ? opts.endpoint + '?limit=500&offset=0' + ? opts.endpoint + '?limit=' + (opts.fetchLimit || 100) + '&offset=0' : opts.endpoint + '?limit=' + opts.perPage + '&offset=' + off; const res = await fetch(url); const data = await res.json(); -- 2.54.0