-
-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat: rewriting (experimental) #10867
Conversation
🦋 Changeset detectedLatest commit: ff5602a The changes in this PR will be included in the next version bump. 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 |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This PR is blocked because it contains a minor
changeset. A reviewer will merge this at the next release if approved.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Generally this seems to look good to me. Is there anything specific you'd also like review on? As I think the other PRs are already reviewed so we don't need a full review here.
Bikeshedding time! Based on some research I think these are the names various frameworks / server give this feature:
|
Great context to add @matthewp! |
Just leaving a comment in response to @ematipico 's request re: documentation. UPDATE: Would love to use Ben's #10858 as a model for experimental feature documentation:
While the feature is experimental, and subject to change, it helps keep the spread in docs controlled for where we need to keep constantly updating. It also stops us from writing too much before the feature is fully finalized. (And, every change we make means the translators JUMP on it... so it helps to wait until we're sure!) BUT (although not my preference): if we REALLY think it's more content than we can reasonably fit in the just experimental domain config, we can add another section to the bottom of the Middleware page as And since we do have experimental domains at the end of the internationalization page, we could get away with the i18n-specific usecase of rerouting, linking back to the main entry on rerouting. This wouldn't need to explain anything, just show an example of using the (experimental) rerouting feature to reroute to a different language page content if one page isn't translated. |
Commit |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @ematipico , the docs part of this is looking great! Just a few suggestions to see what you think!
* chore: implement reroute in dev * chore: revert naming change * chore: conditionally create the new request * chore: handle error * remove only * remove only * chore: add tests and remove logs * chore: fix regression * chore: fix regression route matching * chore: remove unwanted test
* feat: rerouting in ssg * linting
* feat: implement reroute in dev (#10818) * chore: implement reroute in dev * chore: revert naming change * chore: conditionally create the new request * chore: handle error * remove only * remove only * chore: add tests and remove logs * chore: fix regression * chore: fix regression route matching * chore: remove unwanted test * feat: reroute in SSG (#10843) * feat: rerouting in ssg * linting * feat: rerouting in ssg * linting * feat: reroute for SSR * fix rebase * fix merge issue
* feat: implement reroute in dev (#10818) * chore: implement reroute in dev * chore: revert naming change * chore: conditionally create the new request * chore: handle error * remove only * remove only * chore: add tests and remove logs * chore: fix regression * chore: fix regression route matching * chore: remove unwanted test * feat: reroute in SSG (#10843) * feat: rerouting in ssg * linting * feat: rerouting in ssg * linting * feat: reroute for SSR * fix rebase * fix merge issue * feat: implement the `next(payload)` feature for rerouting * chore: revert code * chore: fix code * Apply suggestions from code review Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com> --------- Co-authored-by: Bjorn Lu <bjornlu.dev@gmail.com>
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
.changeset/pink-ligers-share.md
Outdated
}) | ||
``` | ||
|
||
When enabled, you can use `rewrite()` to **render |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Just checking on this formatting here. Did you mean to split up into two lines like this?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left some comments on error messaging and code nits. Overall, this is very well-considered for an experimental release! Appreciate defensive checks like the infinite loop counter as well. You're the re-right man for the job.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Left one tiny suggestion for the first line of the changeset, otherwise now approving for docs! 🥳
Co-authored-by: Sarah Rainsberger <sarah@rainsberger.ca>
Changes
This is the culmination of the rerouting implementation as experimental.
Here's the RFC: https://github.com/withastro/roadmap/blob/feat/reroute/proposals/0047-rerouting.md
This PR is meant to be merged for v4.8.0.
Testing
Current CI should pass
Docs
cc @withastro/maintainers-docs for feedback!
I will need your help go understand how to document the feature, because this involves Astro pages and middleware.