Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Page props not passed for Index page when Middleware and basePath in use #65745

Open
gavb17 opened this issue May 14, 2024 · 0 comments
Open
Labels
bug Issue was opened via the bug report template. Pages Router Related to Pages Router.

Comments

@gavb17
Copy link

gavb17 commented May 14, 2024

Link to the code that reproduces this issue

https://github.com/gavb17/next-index-bug

To Reproduce

  • npm run dev
  • Open index route under basepath in browser, text on page shows value of prop being passed "Page #"
  • Use text to click through to second page, works as expected "Page #"
  • Click link on second page to go back to index, page loads but passed prop does not show in text (no "Page #" text) nor console output

Current vs. Expected behavior

Expect getServerSideProps to trigger when navigating back to Index page from within the app, and props passed into the page
Current Props are not being passed

Provide environment information

System:
OS: macOS 14.4.1
CPU: (10) arm64 Apple M1 Max
Memory: 279.94 MB / 32.00 GB
Shell: 5.9 - /bin/zsh
Binaries:
Node: 18.18.0 - ~/.nvm/versions/node/v18.18.0/bin/node
npm: 9.8.1 - ~/.nvm/versions/node/v18.18.0/bin/npm
Browsers:
Chrome: 124.0.6367.203
Safari: 17.4.1
npmPackages:
next: 14.2.3 => 14.2.3
react: ^18.2.0 => 18.2.0

Which area(s) are affected? (Select all that apply)

Pages Router

Which stage(s) are affected? (Select all that apply)

next dev (local)

Additional context

App uses middleware.ts file and basePath in next.config, when navigating from a page back to index route the request for pageProps (index.json) in the browser returns a 308 status (expected a 200), and the props from getServerSideProps are lost on page load.

@gavb17 gavb17 added the bug Issue was opened via the bug report template. label May 14, 2024
@github-actions github-actions bot added the Pages Router Related to Pages Router. label May 14, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Issue was opened via the bug report template. Pages Router Related to Pages Router.
Projects
None yet
Development

No branches or pull requests

1 participant