This is the first diff in a stack that reduces the creation of Promises, which seems to overwhelm Hermes (see here).
This diff overhauls useCreateChatThreadItem:
- It converts getLastUpdatedTime so that it returns a function that returns a Promise instead of just a Promise.
- It replaces several of the returned properties with a single getFinalChatThreadItem() async function that returns all of them. I think this is cleaner.
- It introduces lastUpdatedAtMostTimeIncludingSidebars. We need this for a later diff, which uses it to guess an order of which ChatThreadItems to check in order to get the top N ChatThreadItems by (resolved) lastUpdatedTimeIncludingSidebars. This way, we avoid creating the promises unless we need them.
Depends on D13984