register allconvos on ActionPanel start

pull/1528/head
Audric Ackermann 4 years ago
parent 2ae259092f
commit feb6d5a39a
No known key found for this signature in database
GPG Key ID: 999F434D76324AD4

@ -44,6 +44,10 @@ interface Props {
theme: DefaultTheme; theme: DefaultTheme;
} }
/**
* ActionsPanel is the far left banner (not the left pane).
* The panel with buttons to switch between the message/contact/settings/theme views
*/
class ActionsPanelPrivate extends React.Component<Props> { class ActionsPanelPrivate extends React.Component<Props> {
private syncInterval: NodeJS.Timeout | null = null; private syncInterval: NodeJS.Timeout | null = null;
@ -71,7 +75,7 @@ class ActionsPanelPrivate extends React.Component<Props> {
// If that's the case, the save events on our conversation won't be triggering redux updates. // If that's the case, the save events on our conversation won't be triggering redux updates.
// So changes to our conversation won't make a change on the UI. // So changes to our conversation won't make a change on the UI.
// Calling this makes sure that our own conversation is registered to redux. // Calling this makes sure that our own conversation is registered to redux.
ConversationController.getInstance().registerOurPrimaryConvoOnRedux(); ConversationController.getInstance().registerAllConvosToRedux();
// init the messageQueue. In the constructor, we had all not send messages // init the messageQueue. In the constructor, we had all not send messages
// this call does nothing except calling the constructor, which will continue sending message in the pipeline // this call does nothing except calling the constructor, which will continue sending message in the pipeline

@ -316,19 +316,13 @@ export class ConversationController {
this.conversations.reset([]); this.conversations.reset([]);
} }
public registerOurPrimaryConvoOnRedux() { public registerAllConvosToRedux() {
if (window.inboxStore) { if (window.inboxStore) {
const ourPubkey = UserUtils.getOurPubKeyStrFromCache(); this.conversations.forEach((convo: ConversationModel) => {
const ourConversation = this.conversations.get(ourPubkey); // make sure all conversations are registered to forward their commit events to redux
if (!ourConversation) { convo.off('change', this.updateReduxConvoChanged);
window.log.warn( convo.on('change', this.updateReduxConvoChanged);
'Cannot register ourPrimary convo to redux, our convo does not exist' });
);
return;
}
// make sure our conversation is registered to forward it's commit events to redux
ourConversation.off('change', this.updateReduxConvoChanged);
ourConversation.on('change', this.updateReduxConvoChanged);
} }
} }

Loading…
Cancel
Save