Skip to content

Commit fc946bb

Browse files
committed
[fix] #111 페이지네이션 수정
1 parent acb7c1c commit fc946bb

File tree

2 files changed

+29
-40
lines changed

2 files changed

+29
-40
lines changed

Projects/Feature/FeatureContentList/Sources/ContentList/ContentListFeature.swift

Lines changed: 15 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ public struct ContentListFeature {
9494
case 즐겨찾기_링크모음_조회
9595
case 컨텐츠_삭제(id: Int)
9696
case pagenation_네트워크
97-
case 컨텐츠_목록_갱신(size: Int)
97+
case 컨텐츠_목록_갱신
9898
}
9999

100100
public enum ScopeAction: Equatable {
@@ -177,19 +177,12 @@ private extension ContentListFeature {
177177

178178
return .run { _ in await dismiss() }
179179
case .contentListViewOnAppeared:
180-
return .run { [
181-
type = state.contentType,
182-
size = state.domain.contentList.data?.count
183-
] send in
184-
if let size {
185-
await send(.async(.컨텐츠_목록_갱신(size: size)), animation: .pokitSpring)
186-
} else {
187-
switch type {
188-
case .unread:
189-
await send(.async(.읽지않음_컨텐츠_조회), animation: .pokitDissolve)
190-
case .favorite:
191-
await send(.async(.즐겨찾기_링크모음_조회), animation: .pokitDissolve)
192-
}
180+
return .run { [type = state.contentType] send in
181+
switch type {
182+
case .unread:
183+
await send(.async(.읽지않음_컨텐츠_조회), animation: .pokitDissolve)
184+
case .favorite:
185+
await send(.async(.즐겨찾기_링크모음_조회), animation: .pokitDissolve)
193186
}
194187

195188
for await _ in self.pasteBoard.changes() {
@@ -285,7 +278,7 @@ private extension ContentListFeature {
285278
break
286279
}
287280
}
288-
case let .컨텐츠_목록_갱신(size):
281+
case .컨텐츠_목록_갱신:
289282
state.domain.pageable.page = 0
290283
return .run { [
291284
type = state.contentType,
@@ -296,7 +289,7 @@ private extension ContentListFeature {
296289
let contentList = try await remindClient.읽지않음_컨텐츠_조회(
297290
BasePageableRequest(
298291
page: pageable.page,
299-
size: size,
292+
size: pageable.size,
300293
sort: pageable.sort
301294
)
302295
).toDomain()
@@ -305,7 +298,7 @@ private extension ContentListFeature {
305298
let contentList = try await remindClient.즐겨찾기_링크모음_조회(
306299
BasePageableRequest(
307300
page: pageable.page,
308-
size: size,
301+
size: pageable.size,
309302
sort: pageable.sort
310303
)
311304
).toDomain()
@@ -340,15 +333,11 @@ private extension ContentListFeature {
340333
func handleDelegateAction(_ action: Action.DelegateAction, state: inout State) -> Effect<Action> {
341334
switch action {
342335
case .컨텐츠_목록_조회:
343-
if let size = state.domain.contentList.data?.count {
344-
return .send(.async(.컨텐츠_목록_갱신(size: size)), animation: .pokitSpring)
345-
} else {
346-
switch state.contentType {
347-
case .favorite:
348-
return .send(.async(.즐겨찾기_링크모음_조회))
349-
case .unread:
350-
return .send(.async(.읽지않음_컨텐츠_조회))
351-
}
336+
switch state.contentType {
337+
case .favorite:
338+
return .send(.async(.즐겨찾기_링크모음_조회))
339+
case .unread:
340+
return .send(.async(.읽지않음_컨텐츠_조회))
352341
}
353342
default:
354343
return .none

Projects/Feature/FeaturePokit/Sources/PokitRootFeature.swift

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -116,8 +116,8 @@ public struct PokitRootFeature {
116116
case 포킷삭제(categoryId: Int)
117117
case 미분류_카테고리_컨텐츠_페이징_조회
118118
case 카테고리_페이징_조회
119-
case 미분류_카테고리_컨텐츠_조회(size: Int)
120-
case 카테고리_조회(size: Int)
119+
case 미분류_카테고리_컨텐츠_조회
120+
case 카테고리_조회
121121
}
122122

123123
public enum ScopeAction: Equatable {
@@ -225,15 +225,15 @@ private extension PokitRootFeature {
225225
case .pokitRootViewOnAppeared:
226226
switch state.folderType {
227227
case .folder(.포킷):
228-
guard let size = state.domain.categoryList.data?.count else {
228+
guard let _ = state.domain.categoryList.data?.count else {
229229
return .send(.inner(.페이지네이션_초기화))
230230
}
231-
return .send(.async(.카테고리_조회(size: size)), animation: .pokitSpring)
231+
return .send(.async(.카테고리_조회), animation: .pokitSpring)
232232
case .folder(.미분류):
233-
guard let size = state.domain.unclassifiedContentList.data?.count else {
233+
guard let _ = state.domain.unclassifiedContentList.data?.count else {
234234
return .send(.inner(.페이지네이션_초기화))
235235
}
236-
return .send(.async(.미분류_카테고리_컨텐츠_조회(size: size)), animation: .pokitSpring)
236+
return .send(.async(.미분류_카테고리_컨텐츠_조회), animation: .pokitSpring)
237237
default: return .none
238238
}
239239
case .다음페이지_로딩_presented:
@@ -361,29 +361,29 @@ private extension PokitRootFeature {
361361
).toDomain()
362362
await send(.inner(.카테고리_페이지네이션_결과(contentList: classified)), animation: .pokitDissolve)
363363
}
364-
case let .미분류_카테고리_컨텐츠_조회(size):
364+
case .미분류_카테고리_컨텐츠_조회:
365365
state.domain.pageable.page = 0
366366
return .run { [
367367
pageable = state.domain.pageable
368368
] send in
369369
let contentList = try await contentClient.미분류_카테고리_컨텐츠_조회(
370370
.init(
371371
page: pageable.page,
372-
size: size,
372+
size: pageable.size,
373373
sort: pageable.sort
374374
)
375375
).toDomain()
376376
await send(.inner(.미분류_카테고리_컨텐츠_갱신(contentList: contentList)), animation: .pokitSpring)
377377
}
378-
case let .카테고리_조회(size):
378+
case .카테고리_조회:
379379
state.domain.pageable.page = 0
380380
return .run { [
381381
pageable = state.domain.pageable
382382
] send in
383383
let classified = try await categoryClient.카테고리_목록_조회(
384384
.init(
385385
page: pageable.page,
386-
size: size,
386+
size: pageable.size,
387387
sort: pageable.sort
388388
),
389389
true
@@ -491,15 +491,15 @@ private extension PokitRootFeature {
491491
case .미분류_카테고리_컨텐츠_조회:
492492
switch state.folderType {
493493
case .folder(.포킷):
494-
guard let size = state.domain.categoryList.data?.count else {
494+
guard let _ = state.domain.categoryList.data?.count else {
495495
return .send(.inner(.페이지네이션_초기화))
496496
}
497-
return .send(.async(.카테고리_조회(size: size)), animation: .pokitSpring)
497+
return .send(.async(.카테고리_조회), animation: .pokitSpring)
498498
case .folder(.미분류):
499-
guard let size = state.domain.unclassifiedContentList.data?.count else {
499+
guard let _ = state.domain.unclassifiedContentList.data?.count else {
500500
return .send(.inner(.페이지네이션_초기화))
501501
}
502-
return .send(.async(.미분류_카테고리_컨텐츠_조회(size: size)), animation: .pokitSpring)
502+
return .send(.async(.미분류_카테고리_컨텐츠_조회), animation: .pokitSpring)
503503
default: return .none
504504
}
505505
default:

0 commit comments

Comments
 (0)