Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[lib] Check the store when searching for message edits
Summary: It can happen that when creating a thick sidebar, we don't yet have the source message persisted in the DB. In that case, we can try to find the message in Redux store. https://linear.app/comm/issue/ENG-9034/creating-a-thick-sidebar-just-after-sending-a-message-doesnt-work Depends on D13059 Test Plan: Checked if creating a sidebar immediately after sending a message works (before this diff the sidebar isn't created and an exception is thrown). Also checked if creating a message -> editing -> creating a sidebar works (with 10 edits). ``` const tid = uuid.v4(); await this.props.processDMOps({ type: 'create_thread', threadID: tid, creatorID: viewerID, time: Date.now(), threadType: threadTypes.LOCAL, memberIDs: [], roleID: uuid.v4(), newMessageID: uuid.v4(), }); const mid = uuid.v4(); await this.props.processDMOps({ type: 'send_text_message', threadID: tid, creatorID: viewerID, time: Date.now(), messageID: mid, text: `${text}-parent`, }); for (let i = 0; i < 10; i++) { await this.props.processDMOps({ type: 'send_edit_message', threadID: tid, creatorID: viewerID, time: Date.now(), messageID: uuid.v4(), targetMessageID: mid, text: `${text}-${i}`, }); } const sid = uuid.v4(); await this.props.processDMOps({ type: 'create_sidebar', threadID: sid, creatorID: viewerID, time: Date.now(), parentThreadID: tid, memberIDs: [], sourceMessageID: mid, roleID: uuid.v4(), newSidebarSourceMessageID: uuid.v4(), newCreateSidebarMessageID: uuid.v4(), }); await this.props.processDMOps({ type: 'send_text_message', threadID: sid, creatorID: viewerID, time: Date.now(), messageID: uuid.v4(), text: `${text}-sidebar`, }); ``` Reviewers: kamil, inka Reviewed By: kamil Subscribers: ashoat Differential Revision: https://phab.comm.dev/D13122
- Loading branch information