diff options
author | Paul Frazee <pfrazee@gmail.com> | 2022-11-14 15:55:38 -0600 |
---|---|---|
committer | Paul Frazee <pfrazee@gmail.com> | 2022-11-14 15:55:38 -0600 |
commit | 9170040acb3c85a11fcf29c832360c0765a1ba58 (patch) | |
tree | 5cb6a3850eaac1dfafb131d7508f0da0ae4150e8 /src | |
parent | 96dc748733561affb9ee9f9d188b040cf5bb009e (diff) | |
download | voidsky-9170040acb3c85a11fcf29c832360c0765a1ba58.tar.zst |
Update all state on profile change
Diffstat (limited to 'src')
-rw-r--r-- | src/state/models/shell-ui.ts | 5 | ||||
-rw-r--r-- | src/view/com/modals/EditProfile.tsx | 9 | ||||
-rw-r--r-- | src/view/com/profile/ProfileHeader.tsx | 2 | ||||
-rw-r--r-- | src/view/screens/Profile.tsx | 2 |
4 files changed, 14 insertions, 4 deletions
diff --git a/src/state/models/shell-ui.ts b/src/state/models/shell-ui.ts index 8eefc711c..cc884f1c3 100644 --- a/src/state/models/shell-ui.ts +++ b/src/state/models/shell-ui.ts @@ -42,7 +42,10 @@ export class SharePostModel { export class EditProfileModel { name = 'edit-profile' - constructor(public profileView: ProfileViewModel) { + constructor( + public profileView: ProfileViewModel, + public onUpdate?: () => void, + ) { makeAutoObservable(this) } } diff --git a/src/view/com/modals/EditProfile.tsx b/src/view/com/modals/EditProfile.tsx index 2bc02afe6..7310ab592 100644 --- a/src/view/com/modals/EditProfile.tsx +++ b/src/view/com/modals/EditProfile.tsx @@ -11,7 +11,13 @@ import * as Profile from '../../../third-party/api/src/client/types/app/bsky/act export const snapPoints = ['80%'] -export function Component({profileView}: {profileView: ProfileViewModel}) { +export function Component({ + profileView, + onUpdate, +}: { + profileView: ProfileViewModel + onUpdate?: () => void +}) { const store = useStores() const [error, setError] = useState<string>('') const [displayName, setDisplayName] = useState<string>( @@ -41,6 +47,7 @@ export function Component({profileView}: {profileView: ProfileViewModel}) { Toast.show('Profile updated', { position: Toast.positions.TOP, }) + onUpdate?.() store.shell.closeModal() } catch (e: any) { console.error(e) diff --git a/src/view/com/profile/ProfileHeader.tsx b/src/view/com/profile/ProfileHeader.tsx index b7440d313..73ddddde9 100644 --- a/src/view/com/profile/ProfileHeader.tsx +++ b/src/view/com/profile/ProfileHeader.tsx @@ -59,7 +59,7 @@ export const ProfileHeader = observer(function ProfileHeader({ ) } const onPressEditProfile = () => { - store.shell.openModal(new EditProfileModel(view)) + store.shell.openModal(new EditProfileModel(view, onRefreshAll)) } const onPressFollowers = () => { store.nav.navigate(`/profile/${view.handle}/followers`) diff --git a/src/view/screens/Profile.tsx b/src/view/screens/Profile.tsx index ca058722d..7d72715b0 100644 --- a/src/view/screens/Profile.tsx +++ b/src/view/screens/Profile.tsx @@ -123,7 +123,7 @@ export const Profile = observer(({visible, params}: ScreenParams) => { ) { if (uiState.feed.hasContent) { items = uiState.feed.feed.slice() - if (uiState.feed.hasReachedEnd) { + if (!uiState.feed.hasMore) { items.push(END_ITEM) } renderItem = (item: any) => { |