mirror of
https://github.com/purrgrammer/grimoire.git
synced 2026-04-12 08:27:27 +02:00
cb98fc129b4fea90fc4d753975b2d7b534e3f4e5
CRITICAL FIX: Gift wrap service was only initialized when opening the inbox viewer, meaning users wouldn't receive DMs unless they had the inbox window open. This caused the issue where sent messages appeared but received messages didn't. **Root Cause:** 1. Gift wrap service init only happened in InboxViewer component 2. Default settings had enabled=false 3. Subscription only started if enabled=true 4. Result: No subscription → no incoming messages **Solution:** Moved gift wrap service initialization to useAccountSync hook, which runs globally whenever a user is logged in. This ensures DM subscriptions are always active. **Changes:** 1. src/hooks/useAccountSync.ts: * Added gift wrap service initialization when account changes * Auto-enables inbox sync on first login (enabled=true) * Properly cleans up on logout/account change * Runs globally in AppShell, not just in inbox viewer 2. src/components/InboxViewer.tsx: * Removed redundant service initialization * Added comment explaining global init * Kept signer update effect for account switching **Expected Behavior:** - ✅ User logs in → gift wrap subscription starts automatically - ✅ DMs received in real-time even when inbox viewer closed - ✅ Both sent and received messages appear live in chat - ✅ Works with self-chat and group chats - ✅ Proper cleanup on logout **Testing:** 1. Login to account 2. Console should show: '[useAccountSync] Initializing gift wrap service' 3. Open chat with someone (don't open inbox viewer) 4. Have them send you a message 5. Message should appear automatically within 500ms 6. Send a message back 7. Both messages visible without manual sync Co-Authored-By: Claude Sonnet 4.5 <noreply@anthropic.com>
Grimoire
A Nostr protocol explorer and developer tool with a tiling window manager interface.
Features
- Tiling Windows - Each window is a Nostr "app" (profile viewer, event feed, NIP docs, etc.)
- Command Palette - Unix-style commands via
Cmd+Kto open apps and navigate - Multi-workspace - Virtual desktops with independent layouts
- Real-time - Reactive event subscriptions with automatic updates
Stack
React 19, TypeScript, Vite, TailwindCSS, Jotai, Dexie, Applesauce
Getting Started
npm install
npm run dev
Scripts
| Command | Description |
|---|---|
npm run dev |
Start dev server |
npm run build |
Build for production |
npm test |
Run tests in watch mode |
npm run lint |
Lint code |
npm run format |
Format code |
License
MIT
Languages
TypeScript
98.9%
CSS
0.8%
JavaScript
0.3%