Skip to content

feat(message-editor): add prompt history viewer#2057

Open
jonathanlab wants to merge 3 commits intomainfrom
posthog-code/fix-input-focus-and-state-management-issues
Open

feat(message-editor): add prompt history viewer#2057
jonathanlab wants to merge 3 commits intomainfrom
posthog-code/fix-input-focus-and-state-management-issues

Conversation

@jonathanlab
Copy link
Copy Markdown
Contributor

Added a new prompt history viewer


Created with PostHog Code

Generated-By: PostHog Code
Task-Id: a3bb89ed-37d8-44c5-be81-e4a1f677035f
@jonathanlab jonathanlab requested a review from a team May 6, 2026 15:12
@greptile-apps
Copy link
Copy Markdown
Contributor

greptile-apps Bot commented May 6, 2026

Comments Outside Diff (2)

  1. apps/code/src/shared/types/analytics.ts, line 3-6 (link)

    P2 Shared file imports from a feature module

    Every other analytics property interface in this file is defined inline (e.g. TaskCreateProperties, PromptSentProperties). Importing from @features/message-editor/analytics is the only case where @shared/types/analytics.ts reaches into a feature module, inverting the typical dependency direction. This violates the OnceAndOnlyOnce principle for where analytics types live and makes the shared file harder to understand at a glance. Consider moving PromptHistoryOpenedProperties and PromptHistorySelectedProperties directly into this file and deleting apps/code/src/renderer/features/message-editor/analytics.ts.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: apps/code/src/shared/types/analytics.ts
    Line: 3-6
    
    Comment:
    **Shared file imports from a feature module**
    
    Every other analytics property interface in this file is defined inline (e.g. `TaskCreateProperties`, `PromptSentProperties`). Importing from `@features/message-editor/analytics` is the only case where `@shared/types/analytics.ts` reaches into a feature module, inverting the typical dependency direction. This violates the OnceAndOnlyOnce principle for where analytics types live and makes the shared file harder to understand at a glance. Consider moving `PromptHistoryOpenedProperties` and `PromptHistorySelectedProperties` directly into this file and deleting `apps/code/src/renderer/features/message-editor/analytics.ts`.
    
    How can I resolve this? If you propose a fix, please make it concise.

    Note: If this suggestion doesn't match your team's coding style, reply to this and let me know. I'll remember it for next time!

  2. apps/code/src/renderer/features/message-editor/components/PromptHistoryDialog.tsx, line 112-116 (link)

    P2 Redundant reversed dependency in filtered memo

    fuse is already recomputed whenever reversed changes (it's fuse's only dep), so adding reversed to filtered's dependency array is superfluous. When any dep changes React re-runs the callback and closes over the latest reversed in scope, so the no-query branch (if (!q) return reversed) is always safe with just [fuse, query]. The current code is not broken, but the extra dep creates a slightly misleading hint that reversed and fuse could diverge.

    Prompt To Fix With AI
    This is a comment left during a code review.
    Path: apps/code/src/renderer/features/message-editor/components/PromptHistoryDialog.tsx
    Line: 112-116
    
    Comment:
    **Redundant `reversed` dependency in `filtered` memo**
    
    `fuse` is already recomputed whenever `reversed` changes (it's `fuse`'s only dep), so adding `reversed` to `filtered`'s dependency array is superfluous. When any dep changes React re-runs the callback and closes over the latest `reversed` in scope, so the no-query branch (`if (!q) return reversed`) is always safe with just `[fuse, query]`. The current code is not broken, but the extra dep creates a slightly misleading hint that `reversed` and `fuse` could diverge.
    
    
    
    How can I resolve this? If you propose a fix, please make it concise.
Prompt To Fix All With AI
Fix the following 2 code review issues. Work through them one at a time, proposing concise fixes.

---

### Issue 1 of 2
apps/code/src/shared/types/analytics.ts:3-6
**Shared file imports from a feature module**

Every other analytics property interface in this file is defined inline (e.g. `TaskCreateProperties`, `PromptSentProperties`). Importing from `@features/message-editor/analytics` is the only case where `@shared/types/analytics.ts` reaches into a feature module, inverting the typical dependency direction. This violates the OnceAndOnlyOnce principle for where analytics types live and makes the shared file harder to understand at a glance. Consider moving `PromptHistoryOpenedProperties` and `PromptHistorySelectedProperties` directly into this file and deleting `apps/code/src/renderer/features/message-editor/analytics.ts`.

### Issue 2 of 2
apps/code/src/renderer/features/message-editor/components/PromptHistoryDialog.tsx:112-116
**Redundant `reversed` dependency in `filtered` memo**

`fuse` is already recomputed whenever `reversed` changes (it's `fuse`'s only dep), so adding `reversed` to `filtered`'s dependency array is superfluous. When any dep changes React re-runs the callback and closes over the latest `reversed` in scope, so the no-query branch (`if (!q) return reversed`) is always safe with just `[fuse, query]`. The current code is not broken, but the extra dep creates a slightly misleading hint that `reversed` and `fuse` could diverge.

```suggestion
  }, [fuse, query]);
```

Reviews (1): Last reviewed commit: "feat(message-editor): add prompt history..." | Re-trigger Greptile

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.

2 participants