[Glitch] Prevent crash trying to access nullish location state

Port 4fce6e0f7338ee6d6a791039357e8dd69adc206e to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
diondiondion 2026-06-13 14:32:17 +02:00 committed by Claire
parent 4b67d8e34f
commit 7fb9eb452b

View File

@ -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