Skip to content

Commit 19167a8

Browse files
committed
Fix forwardRef for LoadingElement
1 parent 957ec39 commit 19167a8

File tree

2 files changed

+4
-24
lines changed

2 files changed

+4
-24
lines changed

components/dash-core-components/src/components/RangeSlider.react.js

Lines changed: 0 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -190,24 +190,6 @@ RangeSlider.propTypes = {
190190
*/
191191
setProps: PropTypes.func,
192192

193-
/**
194-
* Object that holds the loading state object coming from dash-renderer
195-
*/
196-
loading_state: PropTypes.shape({
197-
/**
198-
* Determines if the component is loading or not
199-
*/
200-
is_loading: PropTypes.bool,
201-
/**
202-
* Holds which property is loading
203-
*/
204-
prop_name: PropTypes.string,
205-
/**
206-
* Holds the name of the component that is loading
207-
*/
208-
component_name: PropTypes.string,
209-
}),
210-
211193
/**
212194
* Used to allow user interactions in this component to be persisted when
213195
* the component - or the page - is refreshed. If `persisted` is truthy and
Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
import React from 'react';
2-
import PropTypes from 'prop-types';
32

43
/**
54
* The loading element is used to add `data-dash-is-loading` attribute
@@ -8,12 +7,14 @@ import PropTypes from 'prop-types';
87
*
98
* See: https://dash.plotly.com/loading-states#check-loading-states-from-components
109
*/
11-
export default function LoadingElement({elementType = 'div', ...props}) {
10+
// eslint-disable-next-line react/prop-types
11+
function LoadingElement({elementType = 'div', ...props}, ref) {
1212
const ctx = window.dash_component_api.useDashContext();
1313
const loading = ctx.useLoading();
1414

1515
const givenProps = {
1616
...props,
17+
ref,
1718
};
1819
if (loading) {
1920
givenProps['data-dash-is-loading'] = true;
@@ -22,7 +23,4 @@ export default function LoadingElement({elementType = 'div', ...props}) {
2223
return React.createElement(elementType, givenProps);
2324
}
2425

25-
LoadingElement.propTypes = {
26-
children: PropTypes.node,
27-
elementType: PropTypes.string,
28-
};
26+
export default React.forwardRef(LoadingElement);

0 commit comments

Comments
 (0)