Skip to content
This repository was archived by the owner on Jun 3, 2024. It is now read-only.

Commit 8e181d7

Browse files
author
Shammamah Hossain
committed
Ensure that components are still in the DOM when they are loading.
1 parent 9bea97b commit 8e181d7

File tree

1 file changed

+21
-8
lines changed

1 file changed

+21
-8
lines changed

src/components/Loading.react.js

Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -40,14 +40,27 @@ export default class Loading extends Component {
4040
if (loading_state && loading_state.is_loading) {
4141
const Spinner = getSpinner(spinnerType);
4242
return (
43-
<Spinner
44-
className={className}
45-
style={style}
46-
status={loading_state}
47-
color={color}
48-
debug={debug}
49-
fullscreen={fullscreen}
50-
/>
43+
<div style={{visibility: 'hidden', position: 'relative'}}>
44+
{this.props.children}
45+
<Spinner
46+
className={className}
47+
style={{
48+
visibility: 'visible',
49+
position: 'absolute',
50+
top: '0',
51+
height: '100%',
52+
width: '100%',
53+
display: 'flex',
54+
'justify-content': 'center',
55+
'align-items': 'center',
56+
...style,
57+
}}
58+
status={loading_state}
59+
color={color}
60+
debug={debug}
61+
fullscreen={fullscreen}
62+
/>
63+
</div>
5164
);
5265
}
5366

0 commit comments

Comments
 (0)