Conversation
🦋 Changeset detectedLatest commit: a756ff1 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 |
6972b25 to
585ce6f
Compare
6f0b63b to
40b0699
Compare
natemoo-re
left a comment
There was a problem hiding this comment.
Code looks good! Just a few thoughts on how we roll this out and talk about it, but nothing blocking.
packages/astro/src/core/app/node.ts
Outdated
| req = createRequestFromNodeRequest(req); | ||
| } | ||
| return super.render(req, routeData, locals); | ||
| return super.render(req, { routeData, locals }); |
There was a problem hiding this comment.
Do any adapters extend from App? They might need to be updated as well, but I guess it's not urgent since this is backwards-compatible.
There was a problem hiding this comment.
Only NodeApp extends from App. Cloudflare uses App as-is.
|
|
||
| async render(request: Request, routeData?: RouteData, locals?: object): Promise<Response> { | ||
| async render(request: Request, options?: RenderOptions): Promise<Response> | ||
| async render(request: Request, routeData?: RouteData, locals?: object): Promise<Response> |
There was a problem hiding this comment.
Adding a /** @deprecated See https://github.com/withastro/astro/pull/9199 */ comment above the old signature would be good so that users get a hint in their editor.
There was a problem hiding this comment.
You can deprecate an overload?!
packages/astro/src/core/app/node.ts
Outdated
| } | ||
| } | ||
| else { | ||
| routeData = routeDataOrOptions as RouteData; |
There was a problem hiding this comment.
Should we log a deprecation warning here? Maintainers probably won't catch this change unless we have visible log.
| In the Integration API, the `app.render()` method of the `App` class has been simplified. | ||
|
|
There was a problem hiding this comment.
I would rephrase this or add a note that this change is really only relevant for adapter/integration maintainers, not a something that users of official Astro adapters need to update.
There was a problem hiding this comment.
Updated in the commit titled "clarify changeset".
bluwy
left a comment
There was a problem hiding this comment.
I think we also need major changesets for @astrojs/node and @astrojs/vercel since they're using a new syntax that won't be compatible with previous Astro versions anymore.
packages/astro/src/core/app/node.ts
Outdated
| req = createRequestFromNodeRequest(req); | ||
| } | ||
| return super.render(req, routeData, locals); | ||
| return super.render(req, { routeData, locals }); |
There was a problem hiding this comment.
I think we can pass this as super.render(req, routeData, locals); like before so that the warning handling is all handled within App, and we don't have to duplicate the validation in NodeApp?
We can also make logRenderOptionsDeprecationWarning private with a leading # then.
There was a problem hiding this comment.
Wouldn't that make it log the warning everytime?
There was a problem hiding this comment.
I'm not sure I understand. Wouldn't the duplicate validation here also log the warning everytime? As long as the consumer of NodeApp (in this case @astrojs/node) uses the new API form, it shouldn't log the warning.
There was a problem hiding this comment.
Wouldn't the duplicate validation here also log the warning everytime?
It doesn't. It only logs a warning when the old API is used.
However, if NodeApp.render in turn uses the base method in the old form, the base method will log a warning everytime no matter what form the adapter author used.
There was a problem hiding this comment.
I think my initial suggestion was incorrect. I meant super.render(req, routeDataOrOptions, locals);. Perhaps that's where the confusion is 😅
If we simply pass the arguments back to super.render, the newer API would also be passed through.
There was a problem hiding this comment.
ok yeah that makes sense
|
@lilnasy can you fix the conflicts so we can get this in? |
583425d to
a756ff1
Compare
|
@lilnasy feel free to merge this if it's ready. or if you're waiting for a docs review? |
|
Yeah, it's ready to merge. I'm under the impression that docs will review 4.0 stuff at a later point (not in the next branch). |
remove warning: [deprecated] The adapter @astro-aws/adapter is using a deprecated signature of the 'app.render()' method. From Astro 4.0, locals and routeData are provided as properties on an optional object to this method. Using the old signature will cause an error in Astro 5.0. See withastro/astro#9199 for more information.
remove warning: [deprecated] The adapter @astro-aws/adapter is using a deprecated signature of the 'app.render()' method. From Astro 4.0, locals and routeData are provided as properties on an optional object to this method. Using the old signature will cause an error in Astro 5.0. See withastro/astro#9199 for more information.
* feat: update Astro render call for v4 The app.render call deprecates the third argument in favor of an object with teh routeData as a property. See withastro/astro#9199 for more information. * chore: add changeset * feat: add v3 render support * fix: resolve import issue with const file remove unused type * feat: add a safe fall-through on version parsing * Sync --------- Co-authored-by: Frank <wangfanjie@gmail.com>
* feat(app): app.render optional object * tests * update vercel and node * update changeset * deprecation notice and loggin * clarify changeset * add node, vercel changeset * deduplicate code
* feat(app): app.render optional object * tests * update vercel and node * update changeset * deprecation notice and loggin * clarify changeset * add node, vercel changeset * deduplicate code
* feat(app): app.render optional object * tests * update vercel and node * update changeset * deprecation notice and loggin * clarify changeset * add node, vercel changeset * deduplicate code

Changes
app.render(request, undefined, locals)->app.render(request, { locals })Testing
Switched a couple of tests to use the new API, keeping two as-is that still test the current API.
Docs