Skip to content

Commit

Permalink
[FEAT/#328] 페이징 개수 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
arinming committed Jan 12, 2025
1 parent a88bca6 commit d5cbc53
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ class SearchDataSourceImpl @Inject constructor(
request.keyword,
request.sortBy,
request.page,
request.size
)

override suspend fun getSearchViews(): BaseResponse<SearchAnnouncementResponseDto> =
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,4 @@ data class SearchRequestDto(
val sortBy: String,
@SerialName("page")
val page: Int,
@SerialName("size")
val size: Int,
)
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ class SearchPagingSource(
keyword = query,
sortBy = sortBy,
page = nextParamKey,
size = params.loadSize
)
)
val totalCount = response.result.totalCount
Expand All @@ -43,8 +42,8 @@ class SearchPagingSource(

override fun getRefreshKey(state: PagingState<Int, Pair<Int, SearchResultResponseDto.SearchAnnouncementDto>>): Int? {
return state.anchorPosition?.let { anchorPosition ->
val anchorPage = state.closestPageToPosition(anchorPosition)
anchorPage?.prevKey?.plus(1) ?: anchorPage?.nextKey?.minus(1)
state.closestPageToPosition(anchorPosition)?.prevKey?.plus(1)
?: state.closestPageToPosition(anchorPosition)?.nextKey?.minus(1)
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@ class SearchRepositoryImpl @Inject constructor(
sortBy: String,
): Flow<PagingData<SearchResult>> {
return Pager(
PagingConfig(pageSize = 100)
PagingConfig(
pageSize = 10,
enablePlaceholders = false
)
) {
SearchPagingSource(
query = query,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,6 @@ class SearchProcessViewModel @Inject constructor(
).cachedIn(viewModelScope)
}


fun updateSearchResult(
internshipId: Long,
title: String,
Expand Down

0 comments on commit d5cbc53

Please sign in to comment.