Batch and preload log row data with throttled requests#21
Closed
SyntaxColoring wants to merge 1 commit into
Closed
Batch and preload log row data with throttled requests#21SyntaxColoring wants to merge 1 commit into
SyntaxColoring wants to merge 1 commit into
Conversation
Replaces per-row useLoadEntry with a single batched loader hook attached to the LogView Body. The loader watches Virtuoso's itemsRendered callback to track the visible range and: - Triggers a load when the visible range comes within 50 rows of the cached range's edges (or has no cache yet). - Eagerly fetches PRELOAD_DISTANCE (200) rows on each side of the visible range in a single getEntries() call. - Discards in-memory data outside that window after each load. - Throttles to one in-flight request at a time. If the visible range shifts during a load, a follow-up request fires as soon as the in-flight one settles, so the cache eventually catches up after fast scrolling. Later queries clobber earlier ones. - Avoids race conditions: the loader is held in component state and is swapped (and the old one disposed) synchronously when logSearcher or entryNumbers change. The cache is cleared in the same render, so data from a previous filter set is never displayed even briefly. Removes Virtuoso's overscan since this preload window replaces it. Co-authored-by: Max Marrone <SyntaxColoring@users.noreply.github.com>
Deploying log-viewer with
|
| Latest commit: |
4d42466
|
| Status: | ✅ Deploy successful! |
| Preview URL: | https://a9ccbfe1.log-viewer.pages.dev |
| Branch Preview URL: | https://cursor-batched-row-loading-8.log-viewer.pages.dev |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Currently, on the log view page, each visible row makes its own request to the backend to load its entry. This change replaces that with a single batched loader hook attached to the
LogViewbody, driven by Virtuoso'sitemsRenderedcallback.Behavior
logSearcher.getEntries()call.logSearcherorentryNumberschange. The cache is cleared in the same render so data from a previous filter set is never shown, even briefly. In-flight loads from the previous filter set become no-ops.Other changes
overscanprop is removed; the new preload window replaces it.useLoadEntryhook and itsuseEffectper row are gone; rows now just consumegetEntry(virtualizedIndex)from the shared loader.Verification
npm run check-types,npm run check-lint,npm run check-format,npm run test, andnpm run buildall pass.