Skip to content

Commit

Permalink
Refresh notifications on screen open (close #214)
Browse files Browse the repository at this point in the history
  • Loading branch information
pfrazee committed Feb 16, 2023
1 parent 62077a8 commit 9359553
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 13 deletions.
24 changes: 12 additions & 12 deletions src/view/com/notifications/Feed.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -38,19 +38,19 @@ export const Feed = observer(function Feed({
}
return <FeedItem item={item} />
}
const onRefresh = () => {
view
.refresh()
.catch(err =>
view.rootStore.log.error('Failed to refresh notifications feed', err),
)
const onRefresh = async () => {
try {
await view.refresh()
} catch (err) {
view.rootStore.log.error('Failed to refresh notifications feed', err)
}
}
const onEndReached = () => {
view
.loadMore()
.catch(err =>
view.rootStore.log.error('Failed to load more notifications', err),
)
const onEndReached = async () => {
try {
await view.loadMore()
} catch (err) {
view.rootStore.log.error('Failed to load more notifications', err)
}
}
let data
if (view.hasLoaded) {
Expand Down
2 changes: 1 addition & 1 deletion src/view/screens/Notifications.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ export const Notifications = ({navIdx, visible}: ScreenParams) => {
return cleanup
}
store.log.debug('Updating notifications feed')
store.me.notifications.update().then(() => {
store.me.notifications.refresh().then(() => {
store.me.notifications.updateReadState()
})
screen('Notifications')
Expand Down

0 comments on commit 9359553

Please sign in to comment.