@@ -14,6 +14,8 @@ function wait(ms) {
14
14
*/
15
15
16
16
export default class Clipboard extends React . Component {
17
+ context = window . dash_component_api . DashContext ;
18
+
17
19
constructor ( props ) {
18
20
super ( props ) ;
19
21
this . copyToClipboard = this . copyToClipboard . bind ( this ) ;
@@ -96,7 +98,7 @@ export default class Clipboard extends React.Component {
96
98
}
97
99
98
100
async loading ( ) {
99
- while ( this . props . loading_state ?. is_loading ) {
101
+ while ( this . context . isLoading ( ) ) {
100
102
await wait ( 100 ) ;
101
103
}
102
104
}
@@ -124,7 +126,7 @@ export default class Clipboard extends React.Component {
124
126
}
125
127
126
128
render ( ) {
127
- const { id, title, className, style, loading_state } = this . props ;
129
+ const { id, title, className, style} = this . props ;
128
130
const copyIcon = < FontAwesomeIcon icon = { faCopy } /> ;
129
131
const copiedIcon = < FontAwesomeIcon icon = { faCheckCircle } /> ;
130
132
const btnIcon = this . state . copied ? copiedIcon : copyIcon ;
@@ -136,9 +138,6 @@ export default class Clipboard extends React.Component {
136
138
style = { style }
137
139
className = { className }
138
140
onClick = { this . onClickHandler }
139
- data-dash-is-loading = {
140
- ( loading_state && loading_state . is_loading ) || undefined
141
- }
142
141
>
143
142
< i > { btnIcon } </ i >
144
143
</ div >
@@ -196,24 +195,6 @@ Clipboard.propTypes = {
196
195
*/
197
196
className : PropTypes . string ,
198
197
199
- /**
200
- * Object that holds the loading state object coming from dash-renderer
201
- */
202
- loading_state : PropTypes . shape ( {
203
- /**
204
- * Determines if the component is loading or not
205
- */
206
- is_loading : PropTypes . bool ,
207
- /**
208
- * Holds which property is loading
209
- */
210
- prop_name : PropTypes . string ,
211
- /**
212
- * Holds the name of the component that is loading
213
- */
214
- component_name : PropTypes . string ,
215
- } ) ,
216
-
217
198
/**
218
199
* Dash-assigned callback that gets fired when the value changes.
219
200
*/
0 commit comments