mirror of
https://github.com/hanzoai/next.js.git
synced 2026-09-24 17:00:51 +00:00
### What? This PR fixes interception routes to work correctly with the `trailingSlash` configuration option. ### Why? Interception routes were not working when users had `trailingSlash: true` in their Next.js config. This was because interception route rewrites were marked as `internal: true`, which caused them to bypass the `modifyRouteRegex` processing that handles trailing slash normalization. When a route is marked as internal and provides its own regex, the code would skip the regex modification step that ensures routes work correctly with both `trailingSlash: true` and `trailingSlash: false` configurations. This meant interception routes would fail to match when trailing slashes were enabled. ### How? 1. **Removed `internal: true` flag** from interception route rewrites in `generate-interception-routes-rewrites.ts`. This ensures they go through the same regex modification process as regular routes, properly handling trailing slash normalization. 2. **Added comprehensive test coverage** by wrapping the parallel routes and interception test suite in `describe.each([true, false])` to test both trailing slash configurations. Updated all URL assertions to account for the trailing slash setting. 3. **Refactored `build-custom-route.ts`** to scope the `source` variable closer to where it's actually used, preventing unnecessary computation for internal routes that already provide a regex. 4. **Moved `next.config.js` inline** to the test file for better organization and to support the parameterized test structure.