()
| 361 | // One back for every leaf: the previous entry when it is ours, otherwise |
| 362 | // the root that owns the page, so a deep link always has a way up. |
| 363 | export const useShellBack = (): (() => void) => { |
| 364 | const router = useRouter(); |
| 365 | |
| 366 | return useCallback(() => { |
| 367 | moveShell(router, ShellMove.Pop, () => { |
| 368 | if (canGoBackInApp()) { |
| 369 | router.back(); |
| 370 | return; |
| 371 | } |
| 372 | |
| 373 | router.push(rootHref[owningRoot(router.pathname)]); |
| 374 | }); |
| 375 | }, [router]); |
| 376 | }; |
no test coverage detected