Prevent crash trying to access nullish location state (#39408)
This commit is contained in:
parent
6cf9be9880
commit
fcf222246a
@ -55,13 +55,11 @@ export const FocusTargetProvider: React.FC<{
|
|||||||
| null
|
| null
|
||||||
>(null);
|
>(null);
|
||||||
|
|
||||||
const {
|
const { pathname, search, state } = useLocation<{
|
||||||
pathname,
|
focusTarget?: FocusTarget;
|
||||||
search,
|
} | null>();
|
||||||
state = {},
|
|
||||||
} = useLocation<{ focusTarget?: FocusTarget } | undefined>();
|
|
||||||
|
|
||||||
const { focusTarget } = state;
|
const { focusTarget } = state ?? {};
|
||||||
|
|
||||||
useLayoutEffect(() => {
|
useLayoutEffect(() => {
|
||||||
// We never want to set focus on page load, so we keep
|
// We never want to set focus on page load, so we keep
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user