Soft Navigation
On a soft navigation - Next.js will render the slot's previously active state, even if it doesn't match the current URL.
Hard Navigation
On a hard navigation - a navigation that requires a full page reload - Next.js will first try to render the unmatched slot's default.js file. If that's not available, a 404 gets rendered.
The 404 for unmatched routes helps ensure that you don't accidentally render a route that shouldn't be parallel rendered.
useSelectedLayoutSegment(s)
Both useSelectedLayoutSegment and useSelectedLayoutSegments accept a parallelRoutesKey, which allows you read the active route segment within that slot.
app/layout.tsx 'use client'
 
import { useSelectedLayoutSegment } from 'next/navigation'
 
export default async function Layout(props: {
  //...
  authModal: React.ReactNode
}) {
  const loginSegments = useSelectedLayoutSegment('authModal')