perf: debounce final-state rendering and decouple LRM score fetches - #41
Merged
Conversation
Addresses issue RaredonLab#32 and related UX feedback: the app now only computes and renders the final state after a user stops interacting, stale in-flight responses are cancelled rather than overwriting current data, and a 'Computing...' badge gives real-time feedback during any fetch. AbortController added to all five data-fetching hooks (useEdges, useTranscripts, useCellBoundaries, useCellColors, useEdgeColors): when a new debounce fires the previous in-flight request is cancelled, so intermediate pan positions or partially-dialled settings never flash onto the canvas. Debounce for settings-driven hooks (useCellColors, useEdgeColors metadata) bumped from 150 ms to 400 ms so rapid sequential gene/LRM/colorBy changes collapse to a single server request. useEdges is split into two independent effects: - Structural effect (viewport/density deps only): POSTs to /query-grouped for positions, metadata, lrm_count, and score_sum. Never re-runs on LRM filter changes. - Score effect (viewport + hiddenLrms deps): POSTs to new /query-scores endpoint for {edge, visible_lrm_count, visible_score_sum} only. Picks the cheaper query direction automatically — WHERE lrm IN (visible_set) when the visible set is small (e.g. user selects 10/559 LRMs → ~98% less parquet scanned), CASE WHEN NOT IN otherwise. Short-circuits entirely when no LRM filter is active. New RenderingStatus component shows a spinner badge in the viewer corner after a 400 ms onset delay whenever any layer for that panel is fetching. Disappears immediately on completion. Works per-panel in split-screen. Loading state tracked via loadingKeys Set in Zustand store. Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
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 freeto 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.
Addresses issue #32 and related UX feedback: the app now only computes and renders the final state after a user stops interacting, stale in-flight responses are cancelled rather than overwriting current data, and a 'Computing...' badge gives real-time feedback during any fetch.
AbortController added to all five data-fetching hooks (useEdges, useTranscripts, useCellBoundaries, useCellColors, useEdgeColors): when a new debounce fires the previous in-flight request is cancelled, so intermediate pan positions or partially-dialled settings never flash onto the canvas. Debounce for settings-driven hooks (useCellColors, useEdgeColors metadata) bumped from 150 ms to 400 ms so rapid sequential gene/LRM/colorBy changes collapse to a single server request.
useEdges is split into two independent effects:
New RenderingStatus component shows a spinner badge in the viewer corner after a 400 ms onset delay whenever any layer for that panel is fetching. Disappears immediately on completion. Works per-panel in split-screen. Loading state tracked via loadingKeys Set in Zustand store.