Skip to content

Commit

Permalink
fix: userActions in feed store
Browse files Browse the repository at this point in the history
  • Loading branch information
DIYgod committed Sep 16, 2024
1 parent 971f81d commit 8da4fb7
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions src/renderer/src/store/feed/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,13 @@ class FeedActions {
feed.errorAt = null
}
if (feed.id) {
if (feed.owner) {
userActions.upsert(feed.owner as UserModel)
}
if (feed.tipUsers) {
userActions.upsert(feed.tipUsers)
}

// Not all API return these fields, so merging is needed here.
const optionalFields = ["owner", "tipUsers"] as const
optionalFields.forEach((field) => {
Expand All @@ -41,13 +48,6 @@ class FeedActions {
}
})

if (feed.owner) {
userActions.upsert(feed.owner as UserModel)
}
if (feed.tipUsers) {
userActions.upsert(feed.tipUsers)
}

state.feeds[feed.id] = feed
} else {
// Store temp feed in memory
Expand Down

0 comments on commit 8da4fb7

Please sign in to comment.