20 messages limit for a chat

When querying messages for a chat, getMessages() returns only last 20 messages.

This bug exist since 5.33.8 version.

Amity SDK version: 6.28.0

Hello, to access messages beyond the 20th, pagination is required.

For more details, please refer to our documentation: Query and Filter Messages - Amity Docs

Thank you for the update! There seems to be a bug with AmityCollection to be returning the previous message objects. Could you please verify on your end?

  1. Enter chat (with 40 messages)
  2. Load the next page
  3. Exit chat (invalidate token, reset collection to nil…)
  4. Enter same chat

Expected behaviour:

  • Load chat with 20 messages

Actual result:

  • Load previous 40 messages the very first time, then go back to loading first 20 messages…

@chrisbay Following your report, we have conducted a review and determined that this behavior aligns with the designed functionality of our product. The system caches data to avoid the need for reloading information.

Thank you for looking into this! Caching data makes sense but what’s odd is that after you invalidate, you get cached data. Hence, one can observe the following crash:

Thread 1: "Invalid batch updates detected: the number of sections and/or rows returned by the data source before and/or after performing the batch updates are inconsistent with the updates.

Hello, just to clarify, are you experiencing a crash while attempting to observe the cache? Is that the issue you’re encountering?

Hello, I go through the documentation you shared but I haven’t found anything related to pagination while using sdk to get messages using getMessages(). Can you please help me a little more or can provide a tutorial link about the same?

@YashK Regarding your question, we recommend that you check this link: https://docs.amity.co/amity-sdk/core-concepts/live-objects-collections/ios#pagination.