Skip to content

Fix draft message persistence between chatroom switches#24

Merged
ftk789 merged 3 commits intoKickTalkOrg:mainfrom
BP602:fix-draft-message-persistence
Oct 14, 2025
Merged

Fix draft message persistence between chatroom switches#24
ftk789 merged 3 commits intoKickTalkOrg:mainfrom
BP602:fix-draft-message-persistence

Conversation

@BP602
Copy link
Contributor

@BP602 BP602 commented Jul 9, 2025

Summary

Implements draft message persistence to resolve the issue where unsent messages are lost when switching between chatrooms.

Changes Made

  • Draft Storage: Added draftMessages Map to ChatProvider state for per-chatroom draft storage
  • DraftManager Component: Created component that automatically saves and restores draft content
  • Auto-save: Draft content is saved on every editor change using Lexical update listeners
  • Auto-restore: Draft content is restored when switching back to a chatroom
  • Auto-cleanup: Drafts are cleared when messages are sent successfully
  • Lexical Compatibility: Fixed node structure by properly using paragraph nodes for text content

Technical Implementation

  • Built on top of PR Fix cross-platform icon compatibility #19 for cross-platform icon compatibility
  • Uses Lexical's registerUpdateListener for real-time draft saving
  • Integrates seamlessly with existing chat input architecture
  • Maintains separate draft state for each chatroom independently

Test Plan

  • Type a message in one chatroom without sending
  • Switch to another chatroom
  • Switch back to the original chatroom
  • Verify the draft message is restored
  • Send the message and verify draft is cleared
  • Verify drafts work independently across multiple chatrooms

Fixes

Closes #23

🤖 Generated with Claude Code

BP602 and others added 2 commits July 7, 2025 13:17
- Add cross-platform icon handling for Linux/macOS support
- Convert Windows .ico to .png for non-Windows platforms
- Update tray and thumbar icons to use platform-appropriate format

Fixes application crashes on Linux due to unsupported .ico format

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

Co-Authored-By: Claude <noreply@anthropic.com>
- Add draft storage to ChatProvider state using Map for per-chatroom drafts
- Create DraftManager component to handle automatic saving and restoration
- Save draft content on editor changes using Lexical update listeners
- Restore draft content when switching back to chatrooms
- Clear drafts when messages are sent successfully
- Fix Lexical node structure by properly using paragraph nodes

Fixes #23

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

Co-Authored-By: Claude <noreply@anthropic.com>
@BP602
Copy link
Contributor Author

BP602 commented Jul 9, 2025

Encountered issue where emotes (both 7tv and kick) restore as the name and not the image of the emote, but found the same happens on restore last message/arrow up, so will tackle in a separate issue.

@ftk789 ftk789 merged commit 806403a into KickTalkOrg:main Oct 14, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Draft messages are not persisted when switching between chatrooms

2 participants