Add "follows you" information and sync follow state between views (#215)

* Bump @atproto/api@0.1.2 and update API usage

* Add 'follows you' pill to profile header (close #110)

* Add 'follows you' to followers and follows (close #103)

* Update reposted-by and liked-by views to use the same components as followers and following

* Create a local follows cache MyFollowsModel to keep views in sync (close #205)

* Add incremental hydration to the MyFollows model

* Fix tests

* Update deps

* Fix lint

* Fix to paginated fetches

* Fix reference

* Fix potential state-desync issue
This commit is contained in:
Paul Frazee
2023-02-16 14:34:04 -06:00
committed by GitHub
parent ad4ccade51
commit 70ec76970c
19 changed files with 370 additions and 515 deletions
+8 -3
View File
@@ -6,6 +6,7 @@ import {SessionModel} from '../src/state/models/session'
import {NavigationModel} from '../src/state/models/navigation'
import {ShellUiModel} from '../src/state/models/shell-ui'
import {MeModel} from '../src/state/models/me'
import {MyFollowsModel} from '../src/state/models/my-follows'
import {OnboardModel} from '../src/state/models/onboard'
import {ProfilesViewModel} from '../src/state/models/profiles-view'
import {LinkMetasViewModel} from '../src/state/models/link-metas-view'
@@ -53,9 +54,8 @@ export const mockedProfileStore = {
followsCount: 0,
membersCount: 0,
postsCount: 0,
myState: {
follow: '',
member: '',
viewer: {
following: '',
},
rootStore: {} as RootStoreModel,
hasContent: true,
@@ -572,6 +572,10 @@ export const mockedShellStore = {
openLightbox: jest.fn(),
} as ShellUiModel
export const mockedFollowsStore = {
isFollowing: jest.fn().mockReturnValue(false),
} as MyFollowsModel
export const mockedMeStore = {
serialize: jest.fn(),
hydrate: jest.fn(),
@@ -585,6 +589,7 @@ export const mockedMeStore = {
memberships: mockedMembershipsStore,
mainFeed: mockedFeedStore,
notifications: mockedNotificationsStore,
follows: mockedFollowsStore,
clear: jest.fn(),
load: jest.fn(),
clearNotificationCount: jest.fn(),