Repository: next.js
Issue:  Dynamic intercepting parallel route is server side rendered
Labels: linear: next,Parallel & Intercepting Routes

### Verify canary release

- [X] I verified that the issue exists in the latest Next.js canary release

### Provide environment information

```bash
Operating System:
      Platform: darwin
      Arch: arm64
      Version: Darwin Kernel Version 22.4.0: Mon Mar  6 21:00:41 PST 2023; root:xnu-8796.101.5~3/RELEASE_ARM64_T8103
    Binaries:
      Node: 18.12.1
      npm: 9.8.0
      Yarn: 1.22.19
      pnpm: 8.6.0
    Relevant Packages:
      next: 13.4.9
      eslint-config-next: 13.4.10
      react: 18.2.0
      react-dom: 18.2.0
      typescript: 5.1.6
    Next.js Config:
/** @type {import('next').NextConfig} */
const nextConfig = {
    distDir: 'build',
    compiler: {
        removeConsole: process.env.NODE_ENV === 'production',
    },
    images: {
        remotePatterns: [
            {
                protocol: 'https',
                hostname: '**',
            },
        ],
    },
}

module.exports = nextConfig



warn  - Latest canary version not detected, detected: "13.4.9", newest: "13.4.10".
        Please try the latest canary version (`npm install next@canary`) to confirm the issue still exists before creating a new issue.
        Read more - https://nextjs.org/docs/messages/opening-an-issue

(I use version 13.4.9, because in 13.4.10 intercepted parallel routes do not work at all)
```


### Which area(s) of Next.js are affected? (leave empty if unsure)

App Router, Routing (next/router, next/navigation, next/link)

### Link to the code that reproduces this issue or a replay of the bug

https://drive.google.com/file/d/1wCb9VkpbAlH1bT-iIcP3dTYnEEOT3Glw/view?usp=sharing

### To Reproduce

`/src/app/adspaces/[id]/page.tsx`
```
import { AdspaceModalClient } from '@/app/@modal/(.)adspaces/[id]/page.client'
import { prisma } from '@/server/prismaDb'
import { type NextPage } from 'next'
import { notFound } from 'next/navigation'

export const generateStaticParams = async () => {
    const adspaces = await prisma.adspace.findMany({
        select: {
            id: true,
        },
    })
    return adspaces.map(adspace => ({
        id: String(adspace.id),
    }))
}

interface AdspacesProps {
    params: {
        id: string
    }
}
const Adspaces: NextPage<AdspacesProps> = async ({ params }) => {
    const { id } = params
    const adspace = await prisma.adspace.findUnique({
        where: {
            id: Number(id),
        },
        include: {
            sides: true,
        },
    })
    if (!adspace) {
        notFound()
    }

    return <AdspaceModalClient adspace={adspace} />
}

export default Adspaces
```

`/src/app/@modal/(.)adspaces/[id]/page.tsx`
```
import { AdspaceModalClient } from '@/app/@modal/(.)adspaces/[id]/page.client'
import { prisma } from '@/server/prismaDb'
import { type NextPage } from 'next'
import { notFound } from 'next/navigation'

export const generateStaticParams = async () => {
    const adspaces = await prisma.adspace.findMany({
        select: {
            id: true,
        },
    })
    return adspaces.map(adspace => ({
        id: String(adspace.id),
    }))
}

interface AdspacesModalProps {
    params: {
        id: string
    }
}
const AdspacesModal: NextPage<AdspacesModalProps> = async ({ params }) => {
    const { id } = params
    const adspace = await prisma.adspace.findUnique({
        where: {
            id: Number(id),
        },
        include: {
            sides: true,
        },
    })
    if (!adspace) {
        notFound()
    }

    return <AdspaceModalClient adspace={adspace} />
}

export default AdspacesModal
```

`/src/app/layout.tsx`
```
import { TailwindIndicator } from '@/components/tailwind-indicator'
import { Toaster } from '@/components/ui/toaster'
import { WebVitals } from '@/components/web-vitals'
import { websiteMetadata } from '@/config/metadata.config'
import '@/styles/global.css'
import { Metadata } from 'next'
import { Inter } from 'next/font/google'

export const metadata: Metadata = websiteMetadata

const font = Inter({
    subsets: ['latin', 'cyrillic', 'cyrillic-ext'],
    preload: false,
})

interface RootLayoutProps {
    children: React.ReactNode
    modal: React.ReactNode
}
const RootLayout: React.FC<RootLayoutProps> = props => {
    return (
        <html lang="en">
            <body style={font.style}>
                {props.children}
                {props.modal}
                {/*  */}
                <Toaster />
                <TailwindIndicator />
                <WebVitals />
            </body>
        </html>
    )
}

export default RootLayout
```

### Describe the Bug

`/adspaces/[id]` builds normally (SSG), but when I do the same in `/(.)adspaces/[id]`, it somehow becomes SSR, even though each of these pages exports the same generateStaticParams function.

```
$ next build
- info Loaded env from /Users/oleh/Desktop/advertize-new/.env.production
- info Loaded env from /Users/oleh/Desktop/advertize-new/.env
- info Creating an optimized production build  
- info Compiled successfully
- info Linting and checking validity of types  
- info Collecting page data  
[    ] - info Generating static pages (0/53)- warn Entire page /order deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /order
- warn Entire page /(.)order deopted into client-side rendering. https://nextjs.org/docs/messages/deopted-into-client-rendering /(.)order
- info Generating static pages (53/53)
- info Finalizing page optimization  

Route (app)                                Size     First Load JS
┌ ○ /                                      13.8 kB         134 kB
├ λ /(.)adspaces/[id]                      2.11 kB         117 kB
├ ○ /(.)order                              1.32 kB         161 kB
├ ● /adspaces/[id]                         2.11 kB         117 kB
├   ├ /adspaces/1
├   ├ /adspaces/2
├   ├ /adspaces/3
├   └ [+37 more paths]
├ λ /api/order                             0 B                0 B
├ λ /api/revalidate                        0 B                0 B
├ ○ /favicon.ico                           0 B                0 B
├ ○ /manifest.webmanifest                  0 B                0 B
├ ○ /opengraph-image.png                   0 B                0 B
├ ○ /order                                 2.4 kB          167 kB
├ ○ /robots.txt                            0 B                0 B
├ ○ /sitemap.xml                           0 B                0 B
└ ○ /twitter-image.png                     0 B                0 B
+ First Load JS shared by all              77.6 kB
  ├ chunks/698-fa1560bd3d687c07.js         25 kB
  ├ chunks/bce60fc1-1099bf5e527a55df.js    50.5 kB
  ├ chunks/main-app-5c31dc370cc81b80.js    212 B
  └ chunks/webpack-3994cc1df7b93e85.js     1.81 kB

Route (pages)                              Size     First Load JS
─ ○ /404                                   181 B          79.4 kB
+ First Load JS shared by all              79.2 kB
  ├ chunks/framework-8883d1e9be70c3da.js   45 kB
  ├ chunks/main-39568768d6412e27.js        32.2 kB
  ├ chunks/pages/_app-b75b9482ff6ea491.js  195 B
  └ chunks/webpack-3994cc1df7b93e85.js     1.81 kB

λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
○  (Static)  automatically rendered as static HTML (uses no initial props)
●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
```

### Expected Behavior

Expected `/(.)adspaces/[id]` page to be SSG as well. It's something like this:

```
$ next build

Route (app)                                Size     First Load JS
┌ ○ /                                      13.8 kB         134 kB
├ ● /(.)adspaces/[id]                      2.11 kB         117 kB
├   ├ /adspaces/1
├   ├ /adspaces/2
├   ├ /adspaces/3
├   └ [+37 more paths]
├ ○ /(.)order                              1.32 kB         161 kB
├ ● /adspaces/[id]                         2.11 kB         117 kB
├   ├ /adspaces/1
├   ├ /adspaces/2
├   ├ /adspaces/3
├   └ [+37 more paths]
├ λ /api/order                             0 B                0 B
├ λ /api/revalidate                        0 B                0 B
├ ○ /favicon.ico                           0 B                0 B
├ ○ /manifest.webmanifest                  0 B                0 B
├ ○ /opengraph-image.png                   0 B                0 B
├ ○ /order                                 2.4 kB          167 kB
├ ○ /robots.txt                            0 B                0 B
├ ○ /sitemap.xml                           0 B                0 B
└ ○ /twitter-image.png                     0 B                0 B
+ First Load JS shared by all              77.6 kB
  ├ chunks/698-fa1560bd3d687c07.js         25 kB
  ├ chunks/bce60fc1-1099bf5e527a55df.js    50.5 kB
  ├ chunks/main-app-5c31dc370cc81b80.js    212 B
  └ chunks/webpack-3994cc1df7b93e85.js     1.81 kB

Route (pages)                              Size     First Load JS
─ ○ /404                                   181 B          79.4 kB

λ  (Server)  server-side renders at runtime (uses getInitialProps or getServerSideProps)
○  (Static)  automatically rendered as static HTML (uses no initial props)
●  (SSG)     automatically generated as static HTML + JSON (uses getStaticProps)
```

### Which browser are you using? (if relevant)

Brave, Chrome

### How are you deploying your application? (if relevant)

Firebase hosting + firebase functions (firebase does it on its own, I use experimental firebase frameworks)

<sub>[NEXT-2808](https://linear.app/vercel/issue/NEXT-2808/dynamic-intercepting-parallel-route-is-server-side-rendered)</sub>