Skip to content

Conversation

@teemingc
Copy link
Member

@teemingc teemingc commented Feb 2, 2023

fixes #8755

Adds prerendered pages to the manifest so that a middleware can check if a counterpart route exists, and redirect to it.

I'm not too experienced with Express / Polka and writing middleware for them, so I'm sure this can be fixed up a bit.

Specifically, I'm sure there's a way to skip the middleware for serving prerendered routes and go straight to ssr.
We should do this since we already check if it's prerendered or not.

Also, I'm not sure if there are any penalties for including the prerendered routes list in the manifest.

Please don't delete this checklist! Before submitting the PR, please make sure you do the following:

  • It's really useful if your PR references an issue where it is discussed ahead of time. In many cases, features are absent for a reason. For large changes, please create an RFC: https://github.com/sveltejs/rfcs
  • This message body should clearly illustrate what problems it solves.
  • Ideally, include a test that fails without this PR but passes with it.

Tests

  • Run the tests with pnpm test and lint the project with pnpm lint and pnpm check

Changesets

  • If your PR makes a change that should be noted in one or more packages' changelogs, generate a changeset by running pnpm changeset and following the prompts. Changesets that add features should be minor and those that fix bugs should be patch. Please prefix changeset messages with feat:, fix:, or chore:.

@changeset-bot
Copy link

changeset-bot bot commented Feb 2, 2023

🦋 Changeset detected

Latest commit: 4bbaf73

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
@sveltejs/adapter-node Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@teemingc
Copy link
Member Author

teemingc commented Feb 2, 2023

Thanks Rich!

@Rich-Harris
Copy link
Member

this is great. i guess we might decide this needs to be in the framework core somehow (e.g. the server has knowledge of all prerendered paths, and can redirect accordingly), but 👍 for the simple fix for now

@teemingc teemingc deleted the fix-adapter-node-trailing-slash-redirects branch September 21, 2023 00:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Issue with trailingSlash and prerendered routes

2 participants