mirror of
https://github.com/PrimalHQ/primal-web-app.git
synced 2024-10-01 17:31:13 +00:00
Fix DM losing conversation list
This commit is contained in:
parent
a885a3d513
commit
4e8cae5191
@ -77,6 +77,7 @@ export type MessagesContextStore = {
|
||||
getNextConversationPage: () => void,
|
||||
addUserReference: (user: PrimalUser) => void,
|
||||
clearAllMessages: () => void,
|
||||
clearReceiver: () => void,
|
||||
}
|
||||
}
|
||||
|
||||
@ -232,6 +233,11 @@ export const MessagesProvider = (props: { children: ContextChildren }) => {
|
||||
updateStore('senders', reconcile({}));
|
||||
};
|
||||
|
||||
const clearReceiver = () => {
|
||||
updateStore('activePubkey', () => undefined);
|
||||
currentSender = '';
|
||||
};
|
||||
|
||||
const getConversationWithSender = (sender: string | null, until = 0) => {
|
||||
if (!account?.isKeyLookupDone || !account.hasPublicKey() || !sender) {
|
||||
return;
|
||||
@ -891,6 +897,7 @@ export const MessagesProvider = (props: { children: ContextChildren }) => {
|
||||
getNextConversationPage,
|
||||
addUserReference,
|
||||
clearAllMessages,
|
||||
clearReceiver,
|
||||
},
|
||||
});
|
||||
|
||||
|
@ -195,13 +195,9 @@ const Messages: Component = () => {
|
||||
npubToHex(params.sender) :
|
||||
params.sender;
|
||||
|
||||
const url = currentUrl.startsWith('npub') ?
|
||||
npubToHex(currentUrl) :
|
||||
currentUrl;
|
||||
|
||||
if(currentUrl !== sender) {
|
||||
currentUrl = sender;
|
||||
messages?.actions.selectSender(sender);
|
||||
selectSender(sender);
|
||||
}
|
||||
});
|
||||
|
||||
@ -622,6 +618,7 @@ const Messages: Component = () => {
|
||||
newMessageInput && newMessageInput.removeEventListener('keydown', onKeyDown);
|
||||
messages?.actions.clearAllMessages();
|
||||
messages?.actions.selectSender();
|
||||
messages?.actions.clearReceiver();
|
||||
});
|
||||
|
||||
const sendMessage = async () => {
|
||||
|
Loading…
Reference in New Issue
Block a user