Skip to content

Commit

Permalink
fix: move fetch of super likes count to not block the loading state
Browse files Browse the repository at this point in the history
  • Loading branch information
teodorus-nathaniel committed Jan 4, 2024
1 parent 5f11121 commit 8fe6cac
Showing 1 changed file with 3 additions and 1 deletion.
4 changes: 3 additions & 1 deletion src/rtk/features/posts/postsSlice.ts
Original file line number Diff line number Diff line change
Expand Up @@ -243,7 +243,7 @@ export const fetchPosts = createAsyncThunk<PostStruct[], FetchPostsArgs, ThunkAp
)

const fetches: Promise<any>[] = []
fetches.push(dispatch(fetchSuperLikeCounts({ postIds: entities.map(({ id }) => id) })))

if (withOwner) {
const ids = getUniqueOwnerIds(entities)
const prefetchedData = generatePrefetchData<ProfileSpaceIdByAccount>(
Expand Down Expand Up @@ -337,6 +337,8 @@ export const fetchPosts = createAsyncThunk<PostStruct[], FetchPostsArgs, ThunkAp
dataSource,
}),
)
dispatch(fetchSuperLikeCounts({ postIds: newIds }))

withReactionByAccount &&
dispatch(fetchAddressLikeCountSlice({ postIds: newIds, address: withReactionByAccount }))

Expand Down

0 comments on commit 8fe6cac

Please sign in to comment.