Skip to content

Commit ca4193b

Browse files
committed
fix: correctly replace app name in file path
Signed-off-by: Vincenzo Scamporlino <[email protected]>
1 parent df5614b commit ca4193b

File tree

1 file changed

+5
-10
lines changed

1 file changed

+5
-10
lines changed

src/components/pages/Home.tsx

Lines changed: 5 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -116,16 +116,13 @@ const UpdateDocsLink = styled.div`
116116
flex: 1;
117117
`
118118

119-
const getAppInfoInURL = (): {
120-
appPackage: string
121-
appName: string
122-
} => {
119+
const getAppInfoInURL = () => {
123120
// Parses `/?name=RnDiffApp&package=com.rndiffapp` from URL
124121
const { name, package: pkg } = queryString.parse(window.location.search)
125122

126123
return {
127124
appPackage: pkg as string,
128-
appName: name as string,
125+
appName: name as string | null,
129126
}
130127
}
131128

@@ -161,13 +158,13 @@ const Home = () => {
161158
// })
162159

163160
const appInfoInURL = getAppInfoInURL()
164-
const [appName /* setAppName */] = useState('')
161+
const [appName /* setAppName */] = useState(appInfoInURL.appName)
165162
const [appPackage /*setAppPackage*/] = useState<string>(
166163
appInfoInURL.appPackage
167164
)
168165

169166
// Avoid UI lag when typing.
170-
const deferredAppName = useDeferredValue(appName)
167+
const deferredAppName = useDeferredValue(appName || DEFAULT_APP_NAME)
171168
const deferredAppPackage = useDeferredValue(appPackage)
172169

173170
// const homepageUrl = process.env.PUBLIC_URL
@@ -305,9 +302,7 @@ const Home = () => {
305302
shouldShowDiff={shouldShowDiff}
306303
fromVersion={fromVersion}
307304
toVersion={toVersion}
308-
appName={
309-
deferredAppName !== DEFAULT_APP_NAME ? deferredAppName : ''
310-
}
305+
appName={deferredAppName}
311306
appPackage={
312307
deferredAppPackage !== DEFAULT_APP_PACKAGE
313308
? deferredAppPackage

0 commit comments

Comments
 (0)