rsnext/test/e2e/useselectedlayoutsegment-s-in-pages-router
Balázs Orbán 9ae437f4b1
fix(navigation): allow useSelectedLayoutSegment(s) in Pages Router (#62584)
### What?

Do not fail when `useSelectedLayoutSegment` or
`useSelectedLayoutSegments` APIs are called in the Pages Router.

### Why?

This makes migration easier and creates consistency with our other App
Router-specific APIs that inherit the same behavior.

### How?

Similar to #47490, we return `null` if there is no Layout context
(indicating being in Pages Router)

Types are also overridden in the navigation compact module declaration
which kicks in during start to correct the types if we detect a `pages/`
directory.

Note to reviewer: #47490 didn't add a test, so I added one top-level,
let me know if you have a better suggestion for placing.

Closes NEXT-2506
Fixes #61464
2024-02-29 13:14:52 +00:00
..
pages fix(navigation): allow useSelectedLayoutSegment(s) in Pages Router (#62584) 2024-02-29 13:14:52 +00:00
useselectedlayoutsegment-s-in-pages-router.test.ts fix(navigation): allow useSelectedLayoutSegment(s) in Pages Router (#62584) 2024-02-29 13:14:52 +00:00