1
- import React , { useState , useEffect } from 'react'
1
+ import React , { useState , useEffect , useRef } from 'react'
2
2
import styled from '@emotion/styled'
3
3
import { Card , Input , Typography } from 'antd'
4
4
import GitHubButton from 'react-github-btn'
@@ -90,8 +90,11 @@ const Home = () => {
90
90
const [ settings , setSettings ] = useState ( {
91
91
[ `${ SHOW_LATEST_RCS } ` ] : false ,
92
92
} )
93
- const [ appName , setAppName ] = useState ( '' )
94
- const fixedAppName = appName || DEFAULT_APP_NAME
93
+
94
+ const [ appName , setAppName ] = useState ( {
95
+ input : '' ,
96
+ diff : DEFAULT_APP_NAME ,
97
+ } )
95
98
96
99
const homepageUrl = process . env . PUBLIC_URL
97
100
@@ -107,6 +110,11 @@ const Home = () => {
107
110
return
108
111
}
109
112
113
+ setAppName ( ( { input } ) => ( {
114
+ input : '' ,
115
+ diff : input || DEFAULT_APP_NAME ,
116
+ } ) )
117
+
110
118
setFromVersion ( fromVersion )
111
119
setToVersion ( toVersion )
112
120
setShouldShowDiff ( true )
@@ -187,8 +195,10 @@ const Home = () => {
187
195
< Input
188
196
size = "large"
189
197
placeholder = { DEFAULT_APP_NAME }
190
- value = { appName }
191
- onChange = { ( { target } ) => setAppName ( target . value ) }
198
+ value = { appName . input }
199
+ onChange = { ( { target } ) =>
200
+ setAppName ( ( { diff } ) => ( { input : target . value , diff } ) )
201
+ }
192
202
/>
193
203
194
204
< VersionSelector
@@ -204,7 +214,7 @@ const Home = () => {
204
214
shouldShowDiff = { shouldShowDiff }
205
215
fromVersion = { fromVersion }
206
216
toVersion = { toVersion }
207
- appName = { fixedAppName }
217
+ appName = { appName . diff }
208
218
packageName = { packageName }
209
219
language = { language }
210
220
/>
0 commit comments