Initialised message array in redux store

pull/1102/head
Vincent 6 years ago
parent 1689bc617e
commit af29113fab

@ -143,16 +143,23 @@
click: 'onClick', click: 'onClick',
'click .section-toggle': 'toggleSection', 'click .section-toggle': 'toggleSection',
}, },
setupLeftPane() { async setupLeftPane() {
// Here we set up a full redux store with initial state for our LeftPane Root // Here we set up a full redux store with initial state for our LeftPane Root
const convoCollection = getConversations(); const convoCollection = getConversations();
const conversations = convoCollection.map( const conversations = convoCollection.map(
conversation => conversation.cachedProps conversation => conversation.cachedProps
); );
const filledConversations = conversations.map(async conv => {
const messages = await window.getMessagesByKey(conv.id);
return { ...conv, messages};
});
const fullFilledConversations = await Promise.all(filledConversations);
const initialState = { const initialState = {
conversations: { conversations: {
conversationLookup: Signal.Util.makeLookup(conversations, 'id'), conversationLookup: Signal.Util.makeLookup(fullFilledConversations, 'id'),
}, },
user: { user: {
regionCode: window.storage.get('regionCode'), regionCode: window.storage.get('regionCode'),

Loading…
Cancel
Save