This repository was archived by the owner on May 1, 2026. It is now read-only.
fix: short-circuit init visibleLogs when clamp hits zero#581
Merged
Conversation
`[1,2,3].slice(-0)` returns the entire array because `-0` coerces to `0`, so the previous `slice(-Math.max(0, rows - 14 - diffPanelHeight))` showed the full log list on terminals that were too short to fit any log lines after the code diff panel. Compute the clamp into a named variable and explicitly short-circuit to `[]` when it hits zero.
|
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 subscribe to this conversation on GitHub.
Already have an account?
Sign in.
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
[1,2,3].slice(-0)returns the entire array because-0coerces to0, so the previoussnapshot.logs.slice(-Math.max(0, rows - 14 - diffPanelHeight))showed the full log list on terminals that were too short to fit any log lines after the code diff panel landed (PR feat: show code change diff panel during init onboarding step 5 #580).visibleLogCountand explicitly short-circuit to[]when it hits zero, so a zero-budget viewport renders no logs instead of every log.Test plan
rows - 14 - diffPanelHeight <= 0during init step 5 and confirm no log lines are rendered (prompt + spinner + diff panel only).visibleLogCountlines are still shown.bun run build— passes.