@@ -62,13 +62,25 @@ const Loading = ({
62
62
if ( ! target_components ) {
63
63
return true ;
64
64
}
65
- const isMatchingComponent = target_components . some ( component => {
66
- const [ component_name , prop_name ] = Object . entries ( component ) [ 0 ] ;
67
- return (
68
- loading_state . component_name === component_name &&
69
- loading_state . prop_name === prop_name
65
+ const isMatchingComponent = ( ) => {
66
+ return Object . entries ( target_components ) . some (
67
+ ( [ component_name , prop_names ] ) => {
68
+ // Convert prop_names to an array if it's not already
69
+ const prop_names_array = Array . isArray ( prop_names )
70
+ ? prop_names
71
+ : [ prop_names ] ;
72
+
73
+ return (
74
+ loading_state . component_name === component_name &&
75
+ ( prop_names_array . includes ( '*' ) ||
76
+ prop_names_array . some (
77
+ prop_name =>
78
+ loading_state . prop_name === prop_name
79
+ ) )
80
+ ) ;
81
+ }
70
82
) ;
71
- } ) ;
83
+ } ;
72
84
return isMatchingComponent ;
73
85
} ;
74
86
@@ -261,10 +273,15 @@ Loading.propTypes = {
261
273
262
274
/**
263
275
* Specify component and prop to trigger showing the loading spinner
264
- * example: `[ {"output-container": "children"}] `
276
+ * example: `{"output-container": "children", "grid": ["rowData", "columnDefs]} `
265
277
*
266
278
*/
267
- target_components : PropTypes . arrayOf ( PropTypes . object ) ,
279
+ target_components : PropTypes . objectOf (
280
+ PropTypes . oneOfType ( [
281
+ PropTypes . string ,
282
+ PropTypes . arrayOf ( PropTypes . string ) ,
283
+ ] )
284
+ ) ,
268
285
269
286
/**
270
287
* Component to use rather than the built-in spinner specified in the `type` prop.
0 commit comments