Skip to content

Commit

Permalink
Revert "workaround: always sort all message"
Browse files Browse the repository at this point in the history
This reverts commit 8e0c00a.
  • Loading branch information
Nagarei committed Jul 20, 2023
1 parent 99f3daa commit d0028ae
Showing 1 changed file with 0 additions and 14 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,6 @@ const useMessageFetcher = (
lastLoadingDirection.value = 'latest'
}

const sortMessages = async (messageIdsParam: ref<MessageId[]>) => {
Promise.all(messageIdsParam.value.map((id) => fetchMessage(id))).then(
(messages) => messages.map((m: Message) => {return { id:m.id, createdAt: new Date(m.createdAt)} })
).then((messages) => {
messages.sort((a, b) => {
if (a.createdAt < b.createdAt) { return -1; }
if (a.createdAt > b.createdAt) { return 1; }
return 0;
})
return messages.map((m) => m.id)
})
}

const onLoadFormerMessagesRequest = async () => {
if (isReachedEnd.value) {
return
Expand Down Expand Up @@ -198,7 +185,6 @@ const useMessageFetcher = (
// https://github.com/traPtitech/traQ_S-UI/issues/1748
if (messageIds.value.includes(messageId)) return
messageIds.value.push(messageId)
messageIds.value = await sortMessages(messageIds.value)
}

const init = () => {
Expand Down

0 comments on commit d0028ae

Please sign in to comment.