Skip to content

Commit edbd121

Browse files
committed
Fix initial loading state
1 parent 523f7b1 commit edbd121

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

src/components/Spinner.js

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,10 +22,11 @@ const Spinner = props => {
2222
fullscreenClassName,
2323
fullscreen_style,
2424
debounce,
25+
show_initially,
2526
...otherProps
2627
} = props;
2728

28-
const [showSpinner, setShowSpinner] = useState(false);
29+
const [showSpinner, setShowSpinner] = useState(show_initially);
2930
const timer = useRef();
3031

3132
useEffect(() => {
@@ -121,7 +122,8 @@ const Spinner = props => {
121122
Spinner._dashprivate_isLoadingComponent = true;
122123

123124
Spinner.defaultProps = {
124-
debounce: 0
125+
debounce: 0,
126+
show_initially: true
125127
};
126128

127129
Spinner.propTypes = {
@@ -187,7 +189,13 @@ Spinner.propTypes = {
187189
* When using the spinner as a loading spinner, add a time delay (in ms) to
188190
* the spinner being removed to prevent flickering.
189191
*/
190-
debounce: PropTypes.number
192+
debounce: PropTypes.number,
193+
194+
/**
195+
* Whether the Spinner should show on app start-up before the loading state
196+
* has been determined. Default True.
197+
*/
198+
show_initially: PropTypes.bool
191199
};
192200

193201
export default Spinner;

0 commit comments

Comments
 (0)