supermemory/apps/web
vorflux b6913a0375 feat: highlight chat shows inline reply and uses highlight as assistant's first message (#944)
## Summary

Changes the highlight "Chat" button behavior:

- **Before**: Clicking "Chat" immediately opened the chat view with "Tell me more about XYZ" sent as the user's first message
- **After**: Clicking "Chat" reveals an inline reply input right under the highlight card. The user types their response, and when they submit:
  - The highlight content appears as the **assistant's first message** (prefixed with "Here is a highlight from your memories:")
  - The user's reply appears as the second message
  - A fresh chat thread is created (no overwriting existing conversations)

### Files Changed

- **`apps/web/components/highlights-card.tsx`** - Added inline reply input UI with send/cancel buttons, keyboard handling (Enter/Escape), auto-focus, and state reset on item navigation or items refresh
- **`apps/web/components/chat/index.tsx`** - Added `queuedHighlightContent` prop, fresh thread creation for highlight chats, deferred `setMessages` to ensure correct Chat instance targeting, and `awaitingHighlightInjectionRef` for safe reply dispatch
- **`apps/web/app/(app)/page.tsx`** - Added `queuedHighlightContent` state, updated `handleHighlightsChat` to accept highlight content + user reply, cleared stale highlight content in `handleHomeChatStart`
- **`apps/web/components/dashboard-view.tsx`** - Updated `onHighlightsChat` type signature
- **`apps/web/components/memories-grid.tsx`** - Updated `HighlightsProps.onChat` type signature

## Testing

### TypeScript
- `npx tsc --noEmit` — no new type errors (all errors are pre-existing in unrelated files)

### Biome
- `bunx biome check --write` — clean on all changed files (pre-existing warnings only in dashboard-view.tsx)

### Automated Tests (via testing subagent)
- **25 passed / 0 failed / 1 skipped** (26 total)
- Tests covered: inline reply input visibility, keyboard handling (Enter/Escape), reply state reset on navigation, highlight content injection as assistant message, user reply dispatch, fresh thread creation, stale highlight content prevention, pagination dot handler
- The testing agent discovered and fixed a race condition where `setMessages` was called before `useChat` had recreated its internal Chat object after `setFallbackChatId` — the fix defers `setMessages` to a separate effect gated on `currentChatId` matching the target
- 1 test skipped (T12): Nova FAB button not separately visible from highlights card button at 1440px viewport — expected structural behavior

---
**Session Details**
- Session: [View Session](https://supermemory.us1.vorflux.com/agent-sessions/9cbf2106-b7b9-4d7c-b275-2a7e72417793)
- Requested by: Soham Daga (soham@supermemory.com)
- Address comments on this PR. Add `(aside)` to your comment to have me ignore it.
2026-05-16 08:11:08 +00:00
..
app feat: highlight chat shows inline reply and uses highlight as assistant's first message (#944) 2026-05-16 08:11:08 +00:00
components feat: highlight chat shows inline reply and uses highlight as assistant's first message (#944) 2026-05-16 08:11:08 +00:00
hooks fix: Add plugin document rendering and MCP preview support (#938) 2026-05-15 18:26:37 +00:00
lib fix: Add plugin document rendering and MCP preview support (#938) 2026-05-15 18:26:37 +00:00
public feat: add codex and revamp plugins page (#931) 2026-05-11 23:13:08 +00:00
stores fix: multi-select propagation bug and redesign selection toolbar (#901) 2026-05-05 22:35:35 +00:00
.env.example feat: deep-research on user profile and tiptap integration (#672) 2026-01-15 21:53:53 +00:00
.gitignore sentry sourcemaps 2025-08-23 09:55:40 -07:00
biome.json feat: mobile responsive, lint formats, toast, render issue fix (#688) 2026-01-21 03:11:53 +00:00
components.json New Version of Supermemory Consumer App 2025-08-16 18:50:10 -07:00
globals.css feat: highlight chat shows inline reply and uses highlight as assistant's first message (#944) 2026-05-16 08:11:08 +00:00
instrumentation-client.ts feat: warning when model is unavailable in the region (#814) 2026-03-28 05:52:41 +00:00
middleware.ts feat: enhanced the integration page for more conversion (#899) 2026-05-04 17:41:52 +00:00
next.config.ts Rewrite @supermemory/memory-graph with perf optimizations + consolidate consumers (#809) 2026-03-28 19:06:27 -07:00
open-next.config.ts feat: mobile responsive, lint formats, toast, render issue fix (#688) 2026-01-21 03:11:53 +00:00
package.json feat: autumn migration (#902) 2026-05-08 22:42:55 +00:00
postcss.config.mjs feat: mobile responsive, lint formats, toast, render issue fix (#688) 2026-01-21 03:11:53 +00:00
README.md New Version of Supermemory Consumer App 2025-08-16 18:50:10 -07:00
tsconfig.json fix 2026-02-09 22:07:09 -08:00
wrangler.jsonc feat: mobile responsive, lint formats, toast, render issue fix (#688) 2026-01-21 03:11:53 +00:00

supermemory Consumer