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
Pagination 은 무한 스크롤이라고도 불리며, DB 데이터를 페이지화해서 조금 조금씩 불러오는 기술이다. 따라서 만약 DB 에서 더 이상 불러올 게 없다면, 더 이상 요청을 보내지 말아야 하므로 더 이상 불러올 수 있는지 없는지 판단하는 상태가 필요하다. -> canUpdateMore
또한 Page 별로 요청은 serial 하게(오름차순) 진행해야 한다. 즉 3페이지를 불러오지도 못했는데, 4페이지에 대한 요청을 하는건 있을 수 없다.
따라서 Template목록 을 반환하는 Repository 는 Template 목록뿐만 아니라, 더 이상 데이터를 부르는게 가능한지를 나타내는 결과 또한 반환해야 한다.
Repository는 기본적으로 쿼리 객체를 받는다. 또한 내가 만든 리스트는 받아오면 안되므로, 내 유저 id 또한 받는다(로그인 되있지 않다면 nil 임)
Firebase 는 기본적으로 데이터 커서를 이용해 Pagination 을 구현할 수 있다. 즉 이전 요청에서 마지막으로 받은 데이터를 쿼리에 넣으면, 그 데이터 이후의 데이터들만 불러온다. 따라서 Repository 는 이전 querySnapshot 에 대한 정보를 가지고 있어야 한다.
reacted with thumbs up emoji reacted with thumbs down emoji reacted with laugh emoji reacted with hooray emoji reacted with confused emoji reacted with heart emoji reacted with rocket emoji reacted with eyes emoji
Uh oh!
There was an error while loading. Please reload this page.
-
Pagination 구현을 위한 전제조건
Repository 구현
Request Template 실행 순서
Beta Was this translation helpful? Give feedback.
All reactions