fix: Issue 681 - Reduce Image Details Repaint Cost On Layer Navigation#683
Open
huntharo wants to merge 3 commits intowagoodman:mainfrom
Open
fix: Issue 681 - Reduce Image Details Repaint Cost On Layer Navigation#683huntharo wants to merge 3 commits intowagoodman:mainfrom
huntharo wants to merge 3 commits intowagoodman:mainfrom
Conversation
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.
Summary
Related to: #681
This PR is stacked on top of (should be rebased and merged after) #682
This PR is intentionally minimal and includes only one functional change:
ImageDetailspane re-render when layer navigation does not change image-details view state (same width and same selected/non-selected status).Scope
Included:
cmd/dive/cli/internal/ui/v1/view/image_details.gocmd/dive/cli/internal/ui/v1/view/image_details_render_cache_test.goNot included:
Why This Fix
On every layer move,
ImageDetails.Render()was repainting a large static body even though its content is image-level, not layer-level.For
ghcr.io/openclaw/openclaw:2026.2.17, the inefficiency table is very large (~49k rows), so repainting this pane on each arrow press created visible lag.What Changed
preRendered).Tests
Added unit tests:
TestImageDetailsShouldRenderOnFirstRenderTestImageDetailsShouldRenderWhenLayoutOrSelectionChangesValidated related behavior still passes:
go test ./cmd/dive/cli/internal/ui/v1/view -count=1go test ./cmd/dive/cli/internal/command/export -count=1go test ./cmd/dive/cli/internal/command/ci -count=1Performance Notes (Layer 1 -> Layer 2 transition)
Measured with targeted profiling of the image-details render work.
Baseline (unmodified code at
issue-681/image-details-performance):2026.2.17):492535821237bytes21.316417ms18.305254ms2026.2.21):1588519bytes68.375µs52.133µsWith this PR:
ImageDetailswhen width/focus are unchanged.Repro Steps
0) Test #682 branch with test case images as baseline
2026.2.17 - Image with problem
chownlayerOnce the UI loads (~40 seconds), press the down arrow in the layer tab (default focus) once. It should move to the next layer in ~1 second. If it takes > 5 seconds you may be using
mainor a branch that does not have the first fix that resolves teh 10+ second layer switch time. Once confirming you have the correct image, press down arrow 5 times quickly and observe that the UI will jump to the fifth layer after about a 1 second pause. This is the problem.2026.2.21 - Image without the problem
chownlayerOnce the UI loads, press the down arrow five times rapidly. The UI should update and move to the next layer before you can press the arrow key again. There will not be a jump of 5 layers in one move.
1) Build this PR branch
2) Test with image that has no issue (control)
Action: press Down from layer 1 to 2 repeatedly.
Expected: immediate navigation, no jumping 5 layers if you press down arrow 5 times rapidly, no hangs
3) Test with image that showed issue
Action: press Down from layer 1 to 2 repeatedly.
Expected: immediate navigation, no jumping 5 layers if you press down arrow 5 times rapidly, no hangs
Risk
Low: