Update all state on profile change
parent
96dc748733
commit
9170040acb
|
@ -42,7 +42,10 @@ export class SharePostModel {
|
||||||
export class EditProfileModel {
|
export class EditProfileModel {
|
||||||
name = 'edit-profile'
|
name = 'edit-profile'
|
||||||
|
|
||||||
constructor(public profileView: ProfileViewModel) {
|
constructor(
|
||||||
|
public profileView: ProfileViewModel,
|
||||||
|
public onUpdate?: () => void,
|
||||||
|
) {
|
||||||
makeAutoObservable(this)
|
makeAutoObservable(this)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,7 +11,13 @@ import * as Profile from '../../../third-party/api/src/client/types/app/bsky/act
|
||||||
|
|
||||||
export const snapPoints = ['80%']
|
export const snapPoints = ['80%']
|
||||||
|
|
||||||
export function Component({profileView}: {profileView: ProfileViewModel}) {
|
export function Component({
|
||||||
|
profileView,
|
||||||
|
onUpdate,
|
||||||
|
}: {
|
||||||
|
profileView: ProfileViewModel
|
||||||
|
onUpdate?: () => void
|
||||||
|
}) {
|
||||||
const store = useStores()
|
const store = useStores()
|
||||||
const [error, setError] = useState<string>('')
|
const [error, setError] = useState<string>('')
|
||||||
const [displayName, setDisplayName] = useState<string>(
|
const [displayName, setDisplayName] = useState<string>(
|
||||||
|
@ -41,6 +47,7 @@ export function Component({profileView}: {profileView: ProfileViewModel}) {
|
||||||
Toast.show('Profile updated', {
|
Toast.show('Profile updated', {
|
||||||
position: Toast.positions.TOP,
|
position: Toast.positions.TOP,
|
||||||
})
|
})
|
||||||
|
onUpdate?.()
|
||||||
store.shell.closeModal()
|
store.shell.closeModal()
|
||||||
} catch (e: any) {
|
} catch (e: any) {
|
||||||
console.error(e)
|
console.error(e)
|
||||||
|
|
|
@ -59,7 +59,7 @@ export const ProfileHeader = observer(function ProfileHeader({
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
const onPressEditProfile = () => {
|
const onPressEditProfile = () => {
|
||||||
store.shell.openModal(new EditProfileModel(view))
|
store.shell.openModal(new EditProfileModel(view, onRefreshAll))
|
||||||
}
|
}
|
||||||
const onPressFollowers = () => {
|
const onPressFollowers = () => {
|
||||||
store.nav.navigate(`/profile/${view.handle}/followers`)
|
store.nav.navigate(`/profile/${view.handle}/followers`)
|
||||||
|
|
|
@ -123,7 +123,7 @@ export const Profile = observer(({visible, params}: ScreenParams) => {
|
||||||
) {
|
) {
|
||||||
if (uiState.feed.hasContent) {
|
if (uiState.feed.hasContent) {
|
||||||
items = uiState.feed.feed.slice()
|
items = uiState.feed.feed.slice()
|
||||||
if (uiState.feed.hasReachedEnd) {
|
if (!uiState.feed.hasMore) {
|
||||||
items.push(END_ITEM)
|
items.push(END_ITEM)
|
||||||
}
|
}
|
||||||
renderItem = (item: any) => {
|
renderItem = (item: any) => {
|
||||||
|
|
Loading…
Reference in New Issue