Skip to content

Conversation

@Linhead
Copy link
Collaborator

@Linhead Linhead commented Oct 21, 2025

Description

Fixed an issue where the chat input field remained disabled when opening existing chats after re-login, particularly affecting chats that weren't loaded on the first page of the chat list (e.g., pinned chats like "Support ADAMANT Foundation").

Root cause: When re-logging with a large chat list (100+ chats), only the first page (25 chats) loads initially with their public keys cached. Opening a chat from a later page resulted in a disabled input because the public key wasn't available in the store. The input would only become enabled after manually scrolling through the chat list to trigger paginated loading.

Solution: Added a check to load the public key for any chat that doesn't have it cached, not just for new chats. Since getPublicKey() already handles caching internally, no unnecessary API calls are made for chats with cached keys.

Changes:

  • Modified handleEmptyChat() condition in Chat.vue from if (isNewChat.value) to if (isNewChat.value || !store.state.publicKeys[props.partnerId])

Related issue

Closes #905

External links (optional)

N/A

Screenshots or videos (optional)

N/A

Breaking changes

None. This is a bug fix that doesn't introduce any breaking changes.

How to test

  1. Setup: Use an account with 100+ chats to ensure pagination
  2. Login to the app and browse through several pages of chats
  3. Logout from the app
  4. Login again with the same account
  5. Test Case 1 - Pinned chat:
    • Scroll to the bottom of the chat list to find a pinned chat (e.g., "Support ADAMANT Foundation")
    • Click on the pinned chat
    • Expected: Input field should be enabled immediately without needing to scroll
  6. Test Case 2 - Chat from later pages:
    • Click on any chat that appears beyond the first 25 chats in the list
    • Expected: Input field should be enabled immediately
  7. Test Case 3 - First page chats (regression test):
    • Click on any chat from the first 25 chats
    • Expected: Input field should work as before (no regression)
  8. Test Case 4 - New chat (regression test):
    • Create a new chat with a user not in your chat list
    • Expected: Input field behavior should remain unchanged

Notes for reviewers

  • The fix is minimal (1 line change) and follows the KISS principle
  • store.dispatch('chat/createChat') internally calls getPublicKey() which checks the cache first (index.js:118-121), preventing unnecessary API calls
  • The createEmptyChat mutation is idempotent and safely handles existing chats (chat/index.js:415)
  • No side effects on existing functionality: the condition is a simple OR that covers both new chats and chats without cached keys

Checklist

  • Code is formatted
  • Tests added/updated (if needed) - N/A
  • Documentation updated (if needed) - N/A
  • Changes tested in all relevant environments - Tested manually with large chat list

@Linhead Linhead requested a review from a team as a code owner October 21, 2025 15:15
@vercel
Copy link

vercel bot commented Oct 21, 2025

The latest updates on your projects. Learn more about Vercel for GitHub.

Project Deployment Preview Comments Updated (UTC)
adamant-im Ready Ready Preview Comment Oct 23, 2025 2:13pm

@github-actions
Copy link

github-actions bot commented Oct 21, 2025

Deployed to https://msg-adamant-pr-907.surge.sh 🚀

@al-onyxprotocol al-onyxprotocol added JavaScript Frontend or backend code in JavaScript UX/UI User interface and experience improvements labels Oct 23, 2025
@al-onyxprotocol
Copy link
Member

❌ Test failed

Test link: https://adamant-xesamtfdf-adamant-team.vercel.app/
Environment: Chrome on macOS

See "Steps to reproduce" in #905.

@Linhead
Copy link
Collaborator Author

Linhead commented Oct 23, 2025

@al-onyxprotocol Fixed

@S-FrontendDev S-FrontendDev self-requested a review November 13, 2025 16:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

JavaScript Frontend or backend code in JavaScript UX/UI User interface and experience improvements

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug] Static chats are read-only after re-login

4 participants