@@ -8,6 +8,7 @@ import { DataPanel } from '@/blocks/remote-data-container/components/panels/Data
8
8
import { OverridesPanel } from '@/blocks/remote-data-container/components/panels/OverridesPanel' ;
9
9
import { PatternSelection } from '@/blocks/remote-data-container/components/pattern-selection/PatternSelection' ;
10
10
import { Placeholder } from '@/blocks/remote-data-container/components/placeholders/Placeholder' ;
11
+ import { PlaceholderError } from '@/blocks/remote-data-container/components/placeholders/PlaceholderError' ;
11
12
import {
12
13
CONTAINER_CLASS_NAME ,
13
14
DISPLAY_QUERY_KEY ,
@@ -39,13 +40,18 @@ export function Edit( props: BlockEditProps< RemoteDataBlockAttributes > ) {
39
40
resetInnerBlocks,
40
41
} = usePatterns ( blockName , rootClientId ) ;
41
42
42
- const { data, fetch, loading, reset } = useRemoteData ( {
43
+ const { data, error , fetch, loading, reset } = useRemoteData ( {
43
44
blockName,
44
45
externallyManagedRemoteData : remoteDataAttribute ,
45
46
externallyManagedUpdateRemoteData : updateRemoteData ,
47
+ // error is passed along with this query key
48
+ // queryKey: 'RemoteDataBlocks\\Config\\Query\\HttpQuery',
49
+ // error is undefined with this query key
46
50
queryKey : DISPLAY_QUERY_KEY ,
47
51
} ) ;
48
52
53
+ console . log ( 'error' , error ) ;
54
+
49
55
const [ showPatternSelection , setShowPatternSelection ] = useState < boolean > ( false ) ;
50
56
51
57
function refreshRemoteData ( ) : void {
@@ -83,6 +89,14 @@ export function Edit( props: BlockEditProps< RemoteDataBlockAttributes > ) {
83
89
}
84
90
}
85
91
92
+ if ( error ) {
93
+ return (
94
+ < div { ...blockProps } >
95
+ < PlaceholderError blockName = { blockConfig . settings . title } error = { error } />
96
+ </ div >
97
+ ) ;
98
+ }
99
+
86
100
// No remote data has been selected yet, show a placeholder.
87
101
if ( ! data ) {
88
102
return (
0 commit comments