A fix for Next.js modals (intercepted routes) not closing when navigating away with <Link>
or router.push()
app
├─ @photoModal
│ ├─ (.)photo
| | └─ [id]
│ │ | └─ page.tsx <----- a modal with links to home, /profile, and /login
│ └─ [...catchAll]
│ │ └─ page.tsx <----- returning null here is supposed to cause modal to hide when