Where is the render method of the AppPageRouteModule class called? #82362
-
SummaryIn packages\next\src\server\route-modules\app-page\module.ts , the AppPageRouteModule class has a function called "render". I'm guessing it is called via a build script or something, so can someone help me with where it might be? Additional informationNo response ExampleNo response |
Beta Was this translation helpful? Give feedback.
Replies: 2 comments 5 replies
-
Nope bad guess - I found also the templates app-page, etc, but you say that doesn't get hits when debugging? Are you debugging this is dev mode, build, start? |
Beta Was this translation helpful? Give feedback.
-
You're correct that AppPageRouteModule's render() method isn’t directly referenced in app-page.ts or edge-ssr.ts. That’s because the call chain originates deeper in the Next.js internal routing and compilation pipeline. Where it's actually triggered: The render() method is called via the handle() method defined in the same module. Here's how it flows: app-page.ts (in next/src/server/app-render/app-page.ts) imports AppPageRouteModule and instantiates it as part of the route handler setup. The route handler is passed into Next's request handler pipeline, which in turn calls the handle() method on the route module. Inside that handle() method, Next.js internally calls: await this.render() This is the point where your render() method is triggered — dynamically, based on the routing context. Why you don’t see it statically in VS Code: Debug Tip: |
Beta Was this translation helpful? Give feedback.
You're correct that AppPageRouteModule's render() method isn’t directly referenced in app-page.ts or edge-ssr.ts. That’s because the call chain originates deeper in the Next.js internal routing and compilation pipeline.
Where it's actually triggered:
The render() method is called via the handle() method defined in the same module. Here's how it flows:
app-page.ts (in next/src/server/app-render/app-page.ts) imports AppPageRouteModule and instantiates it as part of the route handler setup.
The route handler is passed into Next's request handler pipeline, which in turn calls the handle() method on the route module.
Inside that handle() method, Next.js internally calls:
await this.render()
Th…