Skip to content

fix/ui-review-issues#52

Merged
PolarBearEs merged 4 commits into
masterfrom
fix/ui-review-issues
May 23, 2026
Merged

fix/ui-review-issues#52
PolarBearEs merged 4 commits into
masterfrom
fix/ui-review-issues

Conversation

@PolarBearEs
Copy link
Copy Markdown
Owner

No description provided.

@greptile-apps
Copy link
Copy Markdown

greptile-apps Bot commented May 23, 2026

Greptile Summary

This PR refactors Ui dispatch logic into a dispatch_mode helper and introduces a 50ms throttle for aggregate progress re-renders, preventing redundant set_message calls during high-frequency advance_layer_download ticks.

  • dispatch_mode replaces the repeated if let Some(inner) = self.progress() / else if self.is_plain() pattern across all public methods, making Quiet mode handling explicit.
  • AggregateRender captures a snapshot of progress state and is compared against last_rendered to skip identical frames; last_rendered_at gates re-renders to at most once per 50ms on the advance-only hot path.

Confidence Score: 5/5

Safe to merge — the refactoring is behaviorally equivalent for all three UI modes and the new throttle correctly gates renders without dropping any terminal state updates.

All changed paths (dispatch_mode, touch_layer, layer_bar move, throttle guard) preserve the existing behaviour across Progress/Plain/Quiet modes. The throttle's force=true path used by finish_aggregate_layer ensures the final state always renders. No data loss, stale state, or incorrect output is introduced.

No files require special attention.

Important Files Changed

Filename Overview
src/ui.rs Refactors UI dispatch into a dispatch_mode helper, introduces render-state deduplication and 50ms throttling for aggregate progress updates, and extracts touch_layer / layer_bar helpers; logic is correct across all modes.

Flowchart

%%{init: {'theme': 'neutral'}}%%
flowchart TD
    A[advance_layer_download] --> B[dispatch_mode]
    B --> C{UiMode?}
    C -- Progress --> D[advance_aggregate_layer\nif aggregate_layers]
    D --> E[drop lock]
    E --> F[render_aggregate_progress_throttled]
    F --> G[acquire aggregate lock]
    G --> H[aggregate_render → AggregateRender]
    H --> I{force?}
    I -- false --> J{elapsed < 50ms?}
    J -- yes --> K[return — skip render]
    J -- no --> L{last_rendered == render?}
    L -- yes --> K
    L -- no --> M[update last_rendered\n+ last_rendered_at]
    I -- true --> M
    M --> N[drop lock]
    N --> O[image.set_style\nimage.set_message]
    C -- Plain --> P[no-op plain branch]
    C -- Quiet --> Q[no-op]
Loading

Reviews (2): Last reviewed commit: "Address UI review follow-ups" | Re-trigger Greptile

Comment thread src/ui.rs
Comment thread src/ui.rs
@PolarBearEs PolarBearEs merged commit b6d950d into master May 23, 2026
11 checks passed
@PolarBearEs PolarBearEs deleted the fix/ui-review-issues branch May 23, 2026 15:18
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