Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(infinite-scroll): optimize error handling in scroll functions #6531

Merged
merged 2 commits into from
Feb 5, 2024
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/components/infinite-scroll/infinite-scroll.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,10 @@
const nextFlag = {}
nextFlagRef.current = nextFlag
await doLoadMore(false)
setFlag(nextFlag)
.then(() => {
setFlag(nextFlag)
})
.catch(() => {})

Check warning on line 79 in src/components/infinite-scroll/infinite-scroll.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/infinite-scroll/infinite-scroll.tsx#L79

Added line #L79 was not covered by tests
}
},
{
Expand Down Expand Up @@ -104,7 +107,10 @@
async function retry() {
setFailed(false)
await doLoadMore(true)
setFlag(nextFlagRef.current)
.then(() => {
setFlag(nextFlagRef.current)

Check warning on line 111 in src/components/infinite-scroll/infinite-scroll.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/infinite-scroll/infinite-scroll.tsx#L110-L111

Added lines #L110 - L111 were not covered by tests
})
.catch(() => {})

Check warning on line 113 in src/components/infinite-scroll/infinite-scroll.tsx

View check run for this annotation

Codecov / codecov/patch

src/components/infinite-scroll/infinite-scroll.tsx#L113

Added line #L113 was not covered by tests
}

return withNativeProps(
Expand Down
Loading