Improvements to feed assembly to avoid possible state issues (#1318)

* Avoid potential dropped posts due to pruning when checking for latest

* Add a sanity check to ensure dup react keys never occur (close #1315)
This commit is contained in:
Paul Frazee 2023-08-28 17:54:59 -07:00 committed by GitHub
parent e2f0770b88
commit 5ee754e6f9
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 18 additions and 4 deletions

View file

@ -105,6 +105,7 @@ export class FeedTuner {
tune(
feed: FeedViewPost[],
tunerFns: FeedTunerFn[] = [],
{dryRun}: {dryRun: boolean} = {dryRun: false},
): FeedViewPostsSlice[] {
let slices: FeedViewPostsSlice[] = []
@ -156,9 +157,11 @@ export class FeedTuner {
}
}
for (const slice of slices) {
for (const item of slice.items) {
this.seenUris.add(item.post.uri)
if (!dryRun) {
for (const slice of slices) {
for (const item of slice.items) {
this.seenUris.add(item.post.uri)
}
}
}