fix: fix bug with disabled input in some chats after logout due to lack of public key #907
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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:
handleEmptyChat()condition inChat.vuefromif (isNewChat.value)toif (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
Notes for reviewers
store.dispatch('chat/createChat')internally callsgetPublicKey()which checks the cache first (index.js:118-121), preventing unnecessary API callscreateEmptyChatmutation is idempotent and safely handles existing chats (chat/index.js:415)Checklist