-
Notifications
You must be signed in to change notification settings - Fork 365
Error handling #1874
ryanvazquez
started this conversation in
General
Error handling
#1874
-
Feature Request: Error Handling Support in FlashList
Problem
We currently use FlashList to render an infinite social feed. A common error handling pattern is to check for an error and render a fallback component:
function MyComponent() { if (error) { return <Error /> } return ( <FlashList ... /> ) }
Issue: This approach completely unmounts FlashList when an error occurs, requiring a full remount after the error is cleared. This results in:
- Loss of scroll position
- Performance overhead from remounting
- Poor user experience during error recovery
Workaround
Errors could be handled at the call site and ignored to keep FlashList mounted:
function MyComponent() { if (error) { // logError('error'); // showToast('error') } return ( <FlashList ... /> ) }
Limitation: While this keeps FlashList mounted, it provides no visual feedback to users about the error state in the list itself.
Proposed Solution
Add built-in error handling support to FlashList, similar to how ListEmptyComponent works:
<FlashList data={data} renderItem={renderItem} ListErrorComponent={ErrorComponent} error={error} // ... other props />
This would allow FlashList to:
- Stay mounted during error states
- Gracefully display error fallbacks
- Maintain scroll position and performance
- Provide an idiomatic error handling pattern
Beta Was this translation helpful? Give feedback.
All reactions
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment