You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
A use case is for the infinite scroll that needs to load previous items when scrolling up, where the pages with higher skip or offset value should be inserted to the beginning of the array. Ex: Chat app. In this case, later paginated items should be added to the beginning instead of the end.
Proposed Solution
Add a new option mergeMode = "before" | "after" to define how pages will be merged. If mergeMode = "after" (default), (later) pages with higher offset will be added after the others. This matches the current behavior so it will not be a breaking change. Otherwise, if mergeMode = "before", (later) pages with higher offset will be added before the others.
Summary
Relay Pagination allows setting
mergeMode
to define how the paginated items are merged. From the doc:We should implement a similar feature in Simple Pagination.
A use case is for the infinite scroll that needs to load previous items when scrolling up, where the pages with higher
skip
oroffset
value should be inserted to the beginning of the array. Ex: Chat app. In this case, later paginated items should be added to the beginning instead of the end.Proposed Solution
Add a new option
mergeMode = "before" | "after"
to define how pages will be merged. IfmergeMode = "after"
(default), (later) pages with higher offset will be added after the others. This matches the current behavior so it will not be a breaking change. Otherwise, ifmergeMode = "before"
, (later) pages with higher offset will be added before the others.Example:
Where
mergeMode = "after"
(default) makes sense:Where
mergeMode = "before"
makes sense:Here is a demo image (source):
The text was updated successfully, but these errors were encountered: