Skip to content

Commit

Permalink
[fix] #152 ContentList 컨텐츠 삭제 반영 문제 수정
Browse files Browse the repository at this point in the history
  • Loading branch information
ShapeKim98 committed Nov 17, 2024
1 parent 73be64b commit ed9bb34
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ public struct ContentCardFeature {
@ObservableState
public struct State: Equatable, Identifiable {
public let id = UUID()
var content: BaseContentItem
public var content: BaseContentItem

public init(content: BaseContentItem) {
self.content = content
Expand Down Expand Up @@ -89,6 +89,7 @@ public struct ContentCardFeature {
/// - Reducer body
public var body: some ReducerOf<Self> {
Reduce(self.core)
._printChanges()
}
}
//MARK: - FeatureAction Effect
Expand Down Expand Up @@ -122,7 +123,7 @@ private extension ContentCardFeature {
return .none
}
return .run { send in
let imageURL = try await swiftSoupClient.parseOGImageURL(url: url)
let imageURL = try await swiftSoupClient.parseOGImageURL(url)
guard let imageURL else { return }
await send(.inner(.메타데이터_조회_수행_반영(imageURL)))
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -217,12 +217,15 @@ private extension ContentListFeature {
case .컨텐츠_삭제_API_반영(id: let id):
state.alertItem = nil
state.domain.contentList.data?.removeAll { $0.id == id }
state.contents.removeAll { $0.content.id == id }
return .none
case .컨텐츠_목록_조회_API_반영(let contentList):
state.domain.contentList = contentList

var identifiedArray = IdentifiedArrayOf<ContentCardFeature.State>()
contentList.data?.forEach { identifiedArray.append(.init(content: $0)) }
state.contents = identifiedArray

state.isLoading = false
return .none
case .페이징_초기화:
Expand Down

0 comments on commit ed9bb34

Please sign in to comment.