Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitff58c71

Browse files
authored
Merge pull requestcoderoad#173 from ShMcK/feature/dont-flash-loading
dont flash loader
2 parentsa9fb1ec +4ac50ba commitff58c71

File tree

1 file changed

+22
-5
lines changed

1 file changed

+22
-5
lines changed

‎web-app/src/containers/Loading/index.tsx

Lines changed: 22 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ import Message from '../../components/Message'
66

77
interfaceProps{
88
text:string
9-
context:T.MachineContext
9+
context?:T.MachineContext
1010
}
1111

1212
conststyles={
@@ -16,19 +16,36 @@ const styles = {
1616
flexDirection:'column'as'column',
1717
alignItems:'center',
1818
justifyContent:'center',
19-
width:'100%',
19+
height:'100%',
2020
},
2121
}
2222

2323
constLoadingPage=({ text, context}:Props)=>{
24-
const{ error}=context
25-
if(error){
24+
const[showLoading,setShowHiding]=React.useState(false)
25+
26+
React.useEffect(()=>{
27+
// wait some time before showing loading indicator
28+
consttimeout=setTimeout(()=>{
29+
setShowHiding(true)
30+
},600)
31+
return()=>{
32+
clearTimeout(timeout)
33+
}
34+
},[])
35+
36+
if(context&&context.error){
2637
return(
2738
<divcss={styles.page}>
28-
<Messagetype="error"title={error.title}content={error.description}/>
39+
<Messagetype="error"title={context.error.title}content={context.error.description}/>
2940
</div>
3041
)
3142
}
43+
44+
// don't flash loader
45+
if(!showLoading){
46+
returnnull
47+
}
48+
3249
return(
3350
<divcss={styles.page}>
3451
<Loadingtext={text}/>

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp