Claude 70db78fe3b refactor: Make republish code production-ready with optimizations and accessibility
Comprehensive improvements to the republish feature for production deployment:

**Performance Optimizations**:
- Use useMemo for expensive computations (seenRelays, connectedRelays, allRelays)
- Use useCallback for event handlers to prevent unnecessary re-renders
- Memoize connected relays filter to avoid duplicate array operations
- Reduce re-renders by caching computed values

**Better Error Handling**:
- Add try-catch with proper error logging to console
- Extract error messages consistently across handlers
- Add .catch() to relay fetch promise for graceful failures
- Prevent duplicate publish operations with guard clauses

**Accessibility Improvements**:
- Add aria-labels to all interactive buttons with descriptive text
- Add role="group" to relay sections for screen readers
- Add role="status" to empty state message
- Add aria-hidden="true" to decorative icons
- Add type="button" to prevent form submission
- Add focus ring styles for keyboard navigation

**Code Quality**:
- Add JSDoc comments to all handler functions
- Better variable naming (isPublishing flag, connectedRelays)
- Consolidate duplicate code (connected relays filter)
- Improve code organization with clear sections
- Remove magic numbers and duplicate logic

**Edge Cases**:
- Check isPublishing before starting batch publish
- Check publishingRelays.has(relay) before individual publish
- Handle relay fetch errors gracefully without crashing
- Proper state cleanup in finally blocks

**State Management**:
- Consistent state updates using functional updates
- Proper Set operations for tracking publishing/published states
- Clear separation between local UI state and event state

All tests pass and build succeeds. Code is now production-ready.
2026-01-14 09:39:58 +00: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
2026-01-13 17:16:31 +01:00
2026-01-13 17:16:31 +01:00
2025-12-20 14:25:40 +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%