Skip to content

Commit

Permalink
fix: In [account] fetchData, set totalPosts with fetchThreadPosts for…
Browse files Browse the repository at this point in the history
… other user (#110)

* fix: In [account] fetchData, set totalPosts with fetchThreadPosts for other user

Signed-off-by: Jeff Thompson <[email protected]>

* fix: In [account] fetchData, use a named variable for `isUserFeed`

Signed-off-by: Jeff Thompson <[email protected]>

---------

Signed-off-by: Jeff Thompson <[email protected]>
  • Loading branch information
jefft0 authored Jun 28, 2024
1 parent dca5b71 commit d8eaa73
Showing 1 changed file with 9 additions and 2 deletions.
11 changes: 9 additions & 2 deletions mobile/app/[account]/index.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,15 @@ export default function Page() {
const { following } = await search.GetJsonFollowing(response.address);
setFollowing(following);

const total = await feed.fetchCount(response.address);
setTotalPosts(total);
const isUserFeed = response.address === currentUser.address
if (isUserFeed) {
const total = await feed.fetchCount(response.address);
setTotalPosts(total);
} else {
// Set startIndex and endIndex to 0 to just get the n_posts.
const r = await feed.fetchThreadPosts(response.address, 0, 0);
setTotalPosts(r.n_posts);
}

const enrichFollows = async (follows: Following[]) => {
for await (const item of follows) {
Expand Down

0 comments on commit d8eaa73

Please sign in to comment.