adding default value to thread in createChatMessageItems
Summary:
Fixes issue described in:
When the user opens a MessageList not available in the MessageStore, the thread has an initial value of undefined.
The loading indicator shows only on message items with itemType: 'loader'.
Giving a default value to thread of { startReached: false|true } fixes the issue without introducing regressions on other test case scenarios.
As on the web, pending threads have a threadID starting with pending/. We can identify them with function threadIsPending.
Test Plan:
I conducted several tests, this are some of the scenarios:
Opening a Subtread after clearing Redux Store (not pending)
EXPECTED SCENARIO: The loading indicator shows over loading chat messages.
https://www.notion.so/commapp/Missing-loading-indicator-when-opening-MessageList-you-are-not-a-member-of-c079e81e7c8f42a58e2ccda9a1f8bece#71f90e46728842f886d8b0f4cc3a0527
Starting a Pending Thread
EXPECTED SCENARIO: The loading indicator does not show.
https://www.notion.so/commapp/Missing-loading-indicator-when-opening-MessageList-you-are-not-a-member-of-c079e81e7c8f42a58e2ccda9a1f8bece#538cd7ea89f647debff4cf3d6695b2da
Scroll Up in a Chatroom
EXPECTED SCENARIO: The loading indicator shows when the user reaches the top of the history while loading new messages
https://www.notion.so/commapp/Missing-loading-indicator-when-opening-MessageList-you-are-not-a-member-of-c079e81e7c8f42a58e2ccda9a1f8bece#1c18462a28bc4714b9753f3a65f1e4e7
Message Creation Failed
https://www.notion.so/commapp/Missing-loading-indicator-when-opening-MessageList-you-are-not-a-member-of-c079e81e7c8f42a58e2ccda9a1f8bece#9054f2bc1a0e4cb5b0ef4f6cac141253
Subthread Creation Failed
https://www.notion.so/commapp/Missing-loading-indicator-when-opening-MessageList-you-are-not-a-member-of-c079e81e7c8f42a58e2ccda9a1f8bece#8898023a39864d069d20b3cb0e33f37a
Further Information at
https://www.notion.so/commapp/Missing-loading-indicator-when-opening-MessageList-you-are-not-a-member-of-c079e81e7c8f42a58e2ccda9a1f8bece
Reviewers: ashoat
Reviewed By: ashoat
Subscribers: KatPo, palys-swm, Adrian, atul
Differential Revision: https://phabricator.ashoat.com/D1420