Alejandro Gómez cb98fc129b fix: Auto-initialize gift wrap subscriptions on login
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>
2026-01-16 14:31:41 +01:00
2025-12-18 15:46:02 +01:00
👶
2025-12-09 16:26:31 +01:00
2025-12-19 12:49:29 +01:00
2025-12-13 15:06:05 +01:00
2025-12-10 13:00:39 +01:00
2025-12-22 20:40:16 +00:00
2025-12-20 14:25:40 +01:00
2026-01-14 19:24:37 +01:00
👶
2025-12-09 16:26:31 +01:00
👶
2025-12-09 16:26:31 +01:00
👶
2025-12-09 16:26:31 +01:00
👶
2025-12-09 16:26:31 +01:00
2025-12-14 16:50:16 +01:00

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+K to 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

Description
No description provided
Readme MIT 14 MiB
Languages
TypeScript 98.9%
CSS 0.8%
JavaScript 0.3%