Fix global navbar crash (#13859)

* use nullish coalescing to prevent nullish query

* actually use nullish coalescing to prevent nullish query
This commit is contained in:
TJ Kandala 2020-09-16 12:38:21 -04:00 committed by GitHub
parent 57b88bf529
commit b51bed6bf8
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -112,7 +112,8 @@ export const GlobalNavbar: React.FunctionComponent<Props> = ({
onNavbarQueryChange({ query, cursorPosition: query.length })
} else {
// If we have no component state, then we may have gotten unmounted during a route change.
const query = location.state ? location.state.query : ''
const query = location.state?.query ?? ''
onNavbarQueryChange({
query,
cursorPosition: query.length,