Skip to content

Commit

Permalink
fix: add feed temp store use nonce
Browse files Browse the repository at this point in the history
Signed-off-by: Innei <i@innei.in>
  • Loading branch information
Innei committed Sep 10, 2024
1 parent 1a2190c commit 6e36232
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/renderer/src/store/feed/store.ts
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class FeedActions {
state.feeds[feed.id] = feed
} else {
// Store temp feed in memory
const nonce = nanoid(8)
const nonce = feed["nonce"] || nanoid(8)
state.feeds[nonce] = { ...feed, id: nonce }
}
}
Expand Down Expand Up @@ -96,13 +96,16 @@ class FeedActions {

const finalData = {
...res.data.feed,
id: id || res.data.feed.id || nonce,
}

if (!finalData.id) {
finalData["nonce"] = nonce
}
this.upsertMany([finalData])

return {
...res.data,
feed: finalData,
feed: !finalData.id ? { ...finalData, id: nonce } : finalData,
}
}
}
Expand Down

0 comments on commit 6e36232

Please sign in to comment.