Skip to content
This repository was archived by the owner on Jan 30, 2026. It is now read-only.

fix: message card rounding with hidden messages#123

Merged
ErikBjare merged 1 commit intomasterfrom
fix/message-rounding-hidden
Jan 29, 2026
Merged

fix: message card rounding with hidden messages#123
ErikBjare merged 1 commit intomasterfrom
fix/message-rounding-hidden

Conversation

@ErikBjare
Copy link
Copy Markdown
Member

@ErikBjare ErikBjare commented Jan 29, 2026

When hidden messages (like auto-included lessons) appear before the first visible message, the rounding was incorrect because prev/next message lookup used array indices ignoring visibility.

Now finds the actual previous/next visible message for proper chain type calculation.


Important

Fixes message chain rounding by filtering hidden messages in useMessageChainType() using isVisibleForChain() in messageUtils.ts.

  • Behavior:
    • Fixes message chain rounding by correctly identifying visible messages in useMessageChainType() in messageUtils.ts.
    • Introduces isVisibleForChain() to filter out hidden messages for chain calculations.
  • Functions:
    • Updates useMessageChainType() to use isVisibleForChain() for determining isChainStart and isChainEnd.

This description was created by Ellipsis for b2991c3. You can customize this summary. It will automatically update as commits are pushed.

Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed everything up to 30ce885 in 8 seconds. Click for details.
  • Reviewed 81 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.

Workflow ID: wflow_7az81lGVLCt2qxf0

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

Hidden messages (like auto-included lessons) should not affect
chain type calculations for rounding. Now treats messages with
hide=true as non-existent when determining if a message is
at the start/end of a chain.
@ErikBjare ErikBjare force-pushed the fix/message-rounding-hidden branch from 30ce885 to b2991c3 Compare January 29, 2026 18:22
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented Jan 29, 2026

Greptile Overview

Greptile Summary

This PR fixes a UI bug where message card rounding was incorrect when hidden messages (like auto-included lessons) appeared before the first visible message.

  • Introduced three helper functions (isMessageVisible, findPrevVisibleIndex, findNextVisibleIndex) that properly handle message visibility logic
  • Changed message rendering to find the actual previous and next visible messages instead of using simple array indices
  • This ensures the useMessageChainType function receives correct neighbor information for proper chain type calculation (standalone/start/middle/end), which controls the visual rounding of message cards
  • The fix properly handles cases where settings.verboseMode toggles visibility of hidden messages and initial system messages

Confidence Score: 5/5

  • Safe to merge - well-implemented bug fix with proper visibility logic
  • The implementation correctly addresses the stated problem with a clean solution. The helper functions are well-structured with proper memoization using useCallback, the logic correctly handles all visibility conditions (initial system messages and hidden messages), and the fix ensures proper chain type calculation for UI rounding. No issues found.
  • No files require special attention

Important Files Changed

Filename Overview
src/components/ConversationContent.tsx Fixes message card rounding by correctly identifying visible messages for chain type calculation

Sequence Diagram

sequenceDiagram
    participant Component as ConversationContent
    participant Helpers as Visibility Helpers
    participant ChatMessage
    participant Utils as messageUtils
    
    Component->>Component: Render message list
    loop For each message
        Component->>Component: Check if message is visible
        alt Message is hidden
            Component->>Component: Render empty div
        else Message is visible
            Component->>Helpers: findPrevVisibleIndex(currentIndex, log)
            Helpers->>Helpers: Loop backwards through messages
            Helpers->>Helpers: Check isMessageVisible for each
            Helpers-->>Component: Return previous visible index
            
            Component->>Helpers: findNextVisibleIndex(currentIndex, log)
            Helpers->>Helpers: Loop forwards through messages
            Helpers->>Helpers: Check isMessageVisible for each
            Helpers-->>Component: Return next visible index
            
            Component->>Component: Get previousMessage$ and nextMessage$
            Component->>ChatMessage: Render with visible neighbors
            ChatMessage->>Utils: useMessageChainType(message$, previousMessage$, nextMessage$)
            Utils->>Utils: Calculate chain type based on visible neighbors
            Utils-->>ChatMessage: Return chain type (standalone/start/middle/end)
            ChatMessage->>ChatMessage: Apply correct rounding based on chain type
        end
    end
Loading

Copy link
Copy Markdown
Contributor

@greptile-apps greptile-apps Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

1 file reviewed, no comments

Edit Code Review Agent Settings | Greptile

Copy link
Copy Markdown
Contributor

@ellipsis-dev ellipsis-dev Bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Important

Looks good to me! 👍

Reviewed b2991c3 in 15 seconds. Click for details.
  • Reviewed 35 lines of code in 1 files
  • Skipped 0 files when reviewing.
  • Skipped posting 0 draft comments. View those below.
  • Modify your settings and rules to customize what types of comments Ellipsis leaves. And don't forget to react with 👍 or 👎 to teach Ellipsis.

Workflow ID: wflow_XPshO2rku20ys0p2

You can customize Ellipsis by changing your verbosity settings, reacting with 👍 or 👎, replying to comments, or adding code review rules.

@ErikBjare ErikBjare merged commit 36d90cf into master Jan 29, 2026
1 check failed
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant