feat: update edgeMiddleware references to middlewareMode#13277
feat: update edgeMiddleware references to middlewareMode#13277leekeh wants to merge 14 commits intowithastro:v6from
edgeMiddleware references to middlewareMode#13277Conversation
✅ Deploy Preview for astro-docs-2 ready!Built without sensitive environment variables
To edit notification comments on pull requests, go to your Netlify project configuration. |
Lunaria Status Overview🌕 This pull request will trigger status changes. Learn moreBy default, every PR changing files present in the Lunaria configuration's You can change this by adding one of the keywords present in the Tracked Files
Warnings reference
|
sarah11918
left a comment
There was a problem hiding this comment.
Thank you for the helpful docs contribution @leekeh ! Just some comments/questions below to help us start to wrangle this into our existing docs style, and I will ask for @ArmandPhilippot 's help too!
Please note that YOU are the expert in your feature, not me... I'm just trying to make the words fit. So I'll need your help to do that, and it's totally expected that you may have to correct me as we work this out! 😄
| } | ||
| ``` | ||
|
|
||
| ### `MiddlewareMode` |
There was a problem hiding this comment.
@ArmandPhilippot I'll ask for your guidance here. Somehow it feels less helpful to have such a short entry here that actually tells people which values they can set as a middleware mode? I would think that that it's more valuable that in the entry above for the config option, people can very quickly see "oh, it's classic or edge!" rather than see "Oh, middleware mode is a middleware mode" then need to follow a trail to get here?
But, what do you think?
There was a problem hiding this comment.
My take would be: Is this type useful so that the user can use it elsewhere (for example, a helper function) or is it only useful in this specific case? I would say the second one here, but I'm not an adapter builder so I could be wrong.
If there are use cases for the type, while I agree with Sarah, I think this can helpful to have an entry for it (so people know they can import it). Otherwise, yes, we probably don't need this and we can replace MiddlewareMode with "classic" | "edge" in the property type!
There was a problem hiding this comment.
Use case would mainly be for adapter developers, to expose this as a property on the adapter. I'd recommend using the type over hardcoding it, since it is going to change in the (near) future.
| </p> | ||
|
|
||
| Defines whether any on-demand rendering middleware code will be bundled when built. | ||
| Defines in which way middleware is run. |
There was a problem hiding this comment.
This is a little vague, and maybe leads to explaining more about what's going on in each option below than might be necessary?
If there does happen to be a defining axis/split on which these two options are clearly different, it would be nice to get that upfront HERE.
(e.g., -- and this is just words as examples for adding more detail, not meant to be accurate -- "Defines when and how middleware is run" at least gives a hint that middleware might run at different times, so people are primed for thinking about choosing options below based on WHEN they'd like their middleware to run. That's still pretty general, so if there is any more precise difference, I'd gladly take something even more informative here!)
There was a problem hiding this comment.
Fair point, I improved it with this:
Determines at which stage of the page lifecycle the middleware is executed, and how the middleware code is emitted in the build output.
Let me know if it suffices.
There was a problem hiding this comment.
Thanks, I think that's so much more helpful to the reader! I appreciate you digging a little deeper.
ArmandPhilippot
left a comment
There was a problem hiding this comment.
Thank you for your contribution and the implementation! 🙌🏽 I left a few comments, feel free to ask if something is not clear.
This is mostly to answer Sarah's question and to try to keep some consistency so that visitors see a similar pattern and are not confused when moving from one section/page to another!
| } | ||
| ``` | ||
|
|
||
| ### `MiddlewareMode` |
There was a problem hiding this comment.
My take would be: Is this type useful so that the user can use it elsewhere (for example, a helper function) or is it only useful in this specific case? I would say the second one here, but I'm not an adapter builder so I could be wrong.
If there are use cases for the type, while I agree with Sarah, I think this can helpful to have an entry for it (so people know they can import it). Otherwise, yes, we probably don't need this and we can replace MiddlewareMode with "classic" | "edge" in the property type!
Co-authored-by: Armand Philippot <git@armand.philippot.eu>
ArmandPhilippot
left a comment
There was a problem hiding this comment.
Thanks for the changes, I personally think this looks better now! I left a few suggestions to fix the code snippets/links.
Co-authored-by: Armand Philippot <git@armand.philippot.eu>
Co-authored-by: Armand Philippot <git@armand.philippot.eu>
sarah11918
left a comment
There was a problem hiding this comment.
Checked the deploy preview and that looks good to me! Thanks for your help writing great docs, @leekeh ! 💪
|
Ah, it seems we have a broken link because of a translation. Adapter reference is not yet translated in Japanese, so If you're able to update: with the following replacement: -[`edgeMiddleware`オプション](/ja/reference/adapter-reference/#edgemiddleware)
+[`middlewareMode`オプション](/ja/reference/adapter-reference/#middlewareMode)The tests should pass! But, if you prefer we can also push a fix to your branch! |
| A set of features that changes the output of the emitted files. When an adapter opts in to these features, they will get additional information inside specific hooks and must implement the proper logic to handle the different output. | ||
|
|
||
| ### `edgeMiddleware` | ||
| ### `middlewareMode` |
There was a problem hiding this comment.
Noting that this is causing a link failure in /ja/ where this is translated and the Netlify guide is linking here.
Would be great if @jp-knj or @morinokami could jump in here! We can translate just the heading, then use that as the anchor link on the Netlify page (but still mark this as [i18nIgnore] so that it's clear the pages do still need the regular updates.
One thing we could do that doesn't have to include any translations yet, since the Netlify guide will need to update anyway is that this PR could temporarily just update the ja adapter page to say (in English) "middlewareMode", and then we hard code the English slug in the broken link. When the translators go to update the Netlify page, they can also change the English heading and slug to translations. (note this would still require [i18nIgnore] in the subject because we would have touched those /ja/ files)
|
Armand and I have to stop meeting like this! 😄 |
yanthomasdev
left a comment
There was a problem hiding this comment.
Thanks @leekeh, I have a few nits 🙌
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
Co-authored-by: Yan <61414485+yanthomasdev@users.noreply.github.com>
edgeMiddleware references to middlewareMode
|
Hi @leekeh ! Just a reminder that we can't merge this PR with a broken link. I think Armand's solution is simpler than mine, so please just update the link anchor as described in his earlier comment here: #13277 (comment) |
ArmandPhilippot
left a comment
There was a problem hiding this comment.
Thank you for fixing that link! 🙌🏽 LGTM! Now, we just need to wait for the implementation to be released before merging the docs!
Thanks 😄 Thanks also for your patience with me, I will try to stick to the rules better in my next contribution 🙂 This was my first one, it's really inspiring to see the level of quality you guys push and the clear guidelines that exist. |
|
(Also updated branch to include the most recent Lunaria fixes) |
|
Thank you so much for your patience with us, @leekeh ! I think updating the URL and the branch should make all the tests pass here. In any case, it's now OUR responsibility to get this into a merge-able shape and out whenever the feature is released. You've done your job, and we appreciate it! 🫡 Welcome to Team Docs! 🥳 |
yanthomasdev
left a comment
There was a problem hiding this comment.
Looking good! Great work here! 🚀
Description (required)
Update documentation to use
middlewareModeinstead ofedgeMiddleware. Context is in linked PR.For Astro version:
6.x. See astro PR #15495.