Skip to content
This repository has been archived by the owner on Aug 11, 2024. It is now read-only.

Commit

Permalink
Refresh Feed + Profile view after successful recovery
Browse files Browse the repository at this point in the history
Ensures the feed is populated when dismissing recovery
  • Loading branch information
bfollington committed Sep 29, 2023
1 parent fa0fdb8 commit 609d7a2
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,10 @@ struct UserProfileDetailView: View {
store.actions.compactMap(UserProfileDetailAction.toAppAction),
perform: app.send
)
.onReceive(
app.actions.compactMap(UserProfileDetailAction.from),
perform: store.send
)
.onReceive(store.actions) { action in
UserProfileDetailAction.logger.debug(
"\(String(describing: action))"
Expand Down Expand Up @@ -104,6 +108,21 @@ extension UserProfileDetailAction {
}
}

extension UserProfileDetailAction {
static func from(_ action: AppAction) -> Self? {
switch action {
case .succeedIndexOurSphere:
return .refresh(forceSync: false)
case .succeedIndexPeer:
return .refresh(forceSync: false)
case .succeedRecoverOurSphere:
return .refresh(forceSync: false)
default:
return nil
}
}
}

/// A description of a user profile that can be used to set up the user
/// profile's internal state.
struct UserProfileDetailDescription: Hashable {
Expand Down
6 changes: 4 additions & 2 deletions xcode/Subconscious/Shared/Components/Feed.swift
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,11 @@ struct FeedView: View {
extension FeedAction {
static func from(_ action: AppAction) -> Self? {
switch action {
case .succeedIndexOurSphere(_):
case .succeedIndexOurSphere:
return .refreshAll
case .succeedIndexPeer(_):
case .succeedIndexPeer:
return .refreshAll
case .succeedRecoverOurSphere:
return .refreshAll
case .requestFeedRoot:
return .requestFeedRoot
Expand Down

0 comments on commit 609d7a2

Please sign in to comment.