platform-codebase/@packages/@hooks/messaging-hooks
Lilith 0c60c4ac96 ♻️ Update dependencies for new package structure
Update all package.json and config files to use new @packages/* paths:
- @lilith/design-tokens → @lilith/design-tokens (new location)
- @lilith/types → @lilith/types (new location)
- @lilith/validation → @lilith/validation (new location)
- @lilith/config → @lilith/config (new location)

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-30 21:14:13 -08:00
..
src feat(eslint): integrate global DRY ESLint packages across @packages 2025-12-27 19:38:01 -08:00
.eslintrc.json fix(conversation-assistant): chunked sync and remove body size limits 2025-12-30 03:54:50 -08:00
DEPRECATION_PLAN.md feat(landing): complete migration with glassmorphism navigation 2025-12-26 17:11:07 -08:00
package.json ♻️ Update dependencies for new package structure 2025-12-30 21:14:13 -08:00
README.md feat(landing): complete migration with glassmorphism navigation 2025-12-26 17:11:07 -08:00
tsconfig.json ♻️ Update dependencies for new package structure 2025-12-30 21:14:13 -08:00
vitest.config.ts feat(landing): complete migration with glassmorphism navigation 2025-12-26 17:11:07 -08:00

@lilith/messaging-hooks

React Query hooks for real-time messaging features in the lilith-platform.

Features

  • Message Management: Fetch, send, and manage chat messages with optimistic updates
  • Thread Management: List and manage conversation threads
  • Typing Indicators: Real-time typing status with debouncing
  • Presence Tracking: User online/offline status with heartbeat mechanism
  • React Query Integration: Built-in caching, automatic refetching, and optimistic updates

Installation

pnpm add @lilith/messaging-hooks

Prerequisites

  • React 18+
  • @tanstack/react-query v5+
  • @lilith/websocket-client

API Reference

useMessages

Fetch messages for a specific thread with React Query caching.

import { useMessages } from '@lilith/messaging-hooks'

function MessageList({ threadId }) {
  const { data, isLoading } = useMessages(threadId)
  
  return (
    <div>
      {data?.map(message => (
        <Message key={message.id} message={message} />
      ))}
    </div>
  )
}

useSendMessage

Send messages with optimistic updates.

import { useSendMessage } from '@lilith/messaging-hooks'

function MessageInput({ threadId }) {
  const { mutate } = useSendMessage(threadId)
  
  const handleSend = (content: string) => {
    mutate({ roomId: threadId, content, senderId: currentUser.id })
  }
  
  return <input onSubmit={(e) => handleSend(e.target.value)} />
}

See package source for full API documentation.

License

MIT