As described on Linear (https://linear.app/comm/issue/ENG-4866/improve-performance-of-re-rendering-chat-list-and-thread-list#comment-e78e87ae), moving lastNavigatedTo and lastPruned out of MessageStore.threads will lead to performance improvements. It also generally decouples the actual MessageStore.threads "content" from information tracked/persisted solely for the purpose of pruning.
Here's a rough plan for the stack:
- Introduce ThreadActivityStore
- Got through every scenario where lastNavigatedTo or lastPruned are updated and ensure we're updating ThreadActivityStore in the same way.
- Modify ThreadPruner to pull from ThreadActivityStore instead of MessageStore.messages (Set to a couple seconds instead of 6 hours to "force" it)
- Deprecate MessageStore.threads[threadID].[lastNavigatedTo/lastPruned] and introduce a Redux migration that maps previous vaues in MessageStore.threads to ThreadActivityStore.