Files
grimoire/src
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
..
2026-01-13 17:16:31 +01:00
2025-12-22 22:38:52 +01:00
2026-01-13 17:16:31 +01:00
2026-01-13 17:16:31 +01:00
2026-01-13 17:16:31 +01:00
2025-12-18 10:19:52 +01:00
👶
2025-12-09 16:26:31 +01:00