When the user wants to create a thread from an edited message, we want him to see the updated content of the message.
Details
- [web & iOS] edited a message, clicked on it to create a sidebar from it, I can see updated content,
- [web] on the pending thread route refreshed site, checked how it behaves: it just redirects to the main thread.
Diff Detail
- Repository
- rCOMM Comm
- Lint
No Lint Coverage - Unit
No Test Coverage
Event Timeline
lib/selectors/chat-selectors.js | ||
---|---|---|
622–623 ↗ | (On Diff #23988) | These two can be combined to reduce one array pass. Note that the callback you pass to useSelector will be executed any time any data in Redux changes, so it's a good idea to prioritize performance here (Flow needs the Boolean pass to be separate however) |
626 ↗ | (On Diff #23988) | This isn't exactly identical, but I think it works here |
lib/selectors/chat-selectors.js | ||
---|---|---|
624–625 ↗ | (On Diff #24060) | Personally I think this condition is more clear if you start by checking message.type, since most message types don't have message.targetMessageID |
lib/selectors/chat-selectors.js | ||
---|---|---|
606–628 ↗ | (On Diff #24267) | This is a very expensive calculation, since you go through every single message in the MessageStore for this thread As mentioned above:
I think it would be good here to pull this out of the useSelector, and put it in a useMemo below. That way, if the underlying data (containingThread.messageIDs?) doesn't change, then the calculation will not have to be run again I'm not sure this is possible in this case, but I suspect it is. Can you think of a good useMemo we can pull out of this? |
lib/selectors/chat-selectors.js | ||
---|---|---|
606–628 ↗ | (On Diff #24267) | I added it as a follow-up task: https://linear.app/comm/issue/ENG-3563/add-usememo-to-pending-thread-edit-messages |
"Add useMemo" isn't a good follow-up task, please respond to the diff comments here directly
lib/selectors/chat-selectors.js | ||
---|---|---|
598 ↗ | (On Diff #24386) | In the codebase we typically do import * as React from 'react'; and then do React.useMemo here |