[Glitch] Prevent crash trying to access nullish location state

Port 4fce6e0f73 to glitch-soc

Signed-off-by: Claire <claire.github-309c@sitedethib.com>
This commit is contained in:
diondiondion authored and Claire committed 2026-06-13 19:20:50 +02:00
1 parent 1b517bdca3
commit 0490e87d94
1 file changed
+4 -6
@@ -55,13 +55,11 @@ export const FocusTargetProvider: React.FC<{
| null
>(null);
const {
pathname,
search,
state = {},
} = useLocation<{ focusTarget?: FocusTarget } | undefined>();
const { pathname, search, state } = useLocation<{
focusTarget?: FocusTarget;
} | null>();
const { focusTarget } = state;
const { focusTarget } = state ?? {};
useLayoutEffect(() => {
// We never want to set focus on page load, so we keep