File tree Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Expand file tree Collapse file tree 2 files changed +18
-4
lines changed Original file line number Diff line number Diff line change 16
16
17
17
import { useEffect , useRef } from 'react'
18
18
import { useIntersection } from '../../Helpers'
19
+ import { GenericSectionErrorState } from '../GenericSectionErrorState'
19
20
20
21
interface DetectBottomProps {
21
22
callback : ( ) => void
23
+ hasError ?: boolean
22
24
}
23
25
24
- const DetectBottom = ( { callback } : DetectBottomProps ) => {
26
+ const DetectBottom = ( { callback, hasError } : DetectBottomProps ) => {
25
27
const target = useRef < HTMLSpanElement > ( null )
26
28
const intersected = useIntersection ( target , {
27
29
rootMargin : '0px' ,
@@ -34,6 +36,14 @@ const DetectBottom = ({ callback }: DetectBottomProps) => {
34
36
}
35
37
} , [ intersected ] )
36
38
39
+ if ( hasError ) {
40
+ return (
41
+ < div className = "p-24 flex" >
42
+ < GenericSectionErrorState reload = { callback } />
43
+ </ div >
44
+ )
45
+ }
46
+
37
47
return < span className = "pb-5" ref = { target } />
38
48
}
39
49
Original file line number Diff line number Diff line change @@ -23,8 +23,11 @@ const PluginList = ({
23
23
const { appId } = useParams < PluginListParamsType > ( )
24
24
25
25
const [ isLoadingMorePlugins , setIsLoadingMorePlugins ] = useState < boolean > ( false )
26
+ const [ hasError , setHasError ] = useState < boolean > ( false )
27
+
26
28
const handleLoadMore = async ( ) => {
27
29
setIsLoadingMorePlugins ( true )
30
+ setHasError ( false )
28
31
try {
29
32
const pluginDataResponse = await abortPreviousRequests (
30
33
( ) =>
@@ -40,7 +43,7 @@ const PluginList = ({
40
43
41
44
handleDataUpdateForPluginResponse ( pluginDataResponse , true )
42
45
} catch ( error ) {
43
- // Do nothing
46
+ setHasError ( true )
44
47
} finally {
45
48
setIsLoadingMorePlugins ( false )
46
49
}
@@ -73,8 +76,9 @@ const PluginList = ({
73
76
74
77
{ isLoadingMorePlugins && < PluginCardSkeletonList /> }
75
78
76
- { /* TODO: Handle on error */ }
77
- { totalCount > pluginList . length && ! isLoadingMorePlugins && < DetectBottom callback = { handleLoadMore } /> }
79
+ { totalCount > pluginList . length && ! isLoadingMorePlugins && (
80
+ < DetectBottom callback = { handleLoadMore } hasError = { hasError } />
81
+ ) }
78
82
</ >
79
83
)
80
84
}
You can’t perform that action at this time.
0 commit comments