Skip to content

docs: document RenderOptions.waitUntil#13744

Open
gllmt wants to merge 2 commits intowithastro:mainfrom
gllmt:docs/renderoptions-waituntil
Open

docs: document RenderOptions.waitUntil#13744
gllmt wants to merge 2 commits intowithastro:mainfrom
gllmt:docs/renderoptions-waituntil

Conversation

@gllmt
Copy link
Copy Markdown

@gllmt gllmt commented Apr 16, 2026

Description (required)

Documents the new RenderOptions.waitUntil() option added by withastro/astro#16187.

This explains how adapter authors can forward a runtime waitUntil() hook to app.render() so runtime cache providers can schedule background work without blocking the response.

Related issues & labels (optional)

For Astro version: 6.2.0. See astro PR withastro/astro#16187.

@netlify
Copy link
Copy Markdown

netlify bot commented Apr 16, 2026

Deploy Preview for astro-docs-2 ready!

Built without sensitive environment variables

Name Link
🔨 Latest commit 50b471b
🔍 Latest deploy log https://app.netlify.com/projects/astro-docs-2/deploys/69e125f9e1c9970008450e45
😎 Deploy Preview https://deploy-preview-13744--astro-docs-2.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

@astrobot-houston
Copy link
Copy Markdown
Contributor

astrobot-houston commented Apr 16, 2026

Lunaria Status Overview

🌕 This pull request will trigger status changes.

Learn more

By default, every PR changing files present in the Lunaria configuration's files property will be considered and trigger status changes accordingly.

You can change this by adding one of the keywords present in the ignoreKeywords property in your Lunaria configuration file in the PR's title (ignoring all files) or by including a tracker directive in the merged commit's description.

Tracked Files

File Note
en/reference/modules/astro-app.mdx Source changed, localizations will be marked as outdated.
Warnings reference
Icon Description
🔄️ The source for this localization has been updated since the creation of this pull request, make sure all changes in the source have been applied.

@gllmt
Copy link
Copy Markdown
Author

gllmt commented Apr 16, 2026

Companion docs PR for withastro/astro#16187. Since this documents a new public option that is not released yet, this should likely follow the usual merge-on-release docs flow.

@astrobot-houston
Copy link
Copy Markdown
Contributor

Hello! Thank you for opening your first PR to Astro’s Docs! 🎉

Here’s what will happen next:

  1. Our GitHub bots will run to check your changes.
    If they spot any broken links you will see some error messages on this PR.
    Don’t hesitate to ask any questions if you’re not sure what these mean!

  2. In a few minutes, you’ll be able to see a preview of your changes on Netlify 🥳.

  3. One or more of our maintainers will take a look and may ask you to make changes.
    We try to be responsive, but don’t worry if this takes a few days.

Copy link
Copy Markdown
Member

@ArmandPhilippot ArmandPhilippot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the fix and the docs! I left a few suggestions, especially around the code snippet, as I'm not sure if it's currently useful.

And, please use our PR template the next time.


If not provided, Astro will fallback to its default behavior for fetching error pages.

#### `RenderOptions.waitUntil`
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use parentheses for functions:

Suggested change
#### `RenderOptions.waitUntil`
#### `RenderOptions.waitUntil()`

Comment on lines +363 to +369
```js "waitUntil"
return app.render(request, {
routeData,
locals,
waitUntil,
});
```
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure the current example is really helpful because this only lists what is available in RenderOptions. Would something like the following would be correct as minimal example?

Suggested change
```js "waitUntil"
return app.render(request, {
routeData,
locals,
waitUntil,
});
```
```js {8}
import { createApp } from 'astro/app/entrypoint';
const app = createApp();
export async function handler(event, context) {
// ...
return app.render(event.request, {
waitUntil: context.waitUntil.bind(context),
});
}
```


Adapters can pass this through to let runtime cache providers schedule work such as cache writes or stale-while-revalidate without blocking the response path.

The following example forwards a runtime's `waitUntil` implementation to [`app.render()`](#apprender):
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See my suggestion for the code snippet:

Suggested change
The following example forwards a runtime's `waitUntil` implementation to [`app.render()`](#apprender):
The following example forwards a runtime's `waitUntil()` implementation to [`app.render()`](#apprender) in an [adapter server entrypoint](/en/reference/adapter-reference/#building-a-server-entrypoint):

@ArmandPhilippot ArmandPhilippot added this to the 6.2 milestone Apr 16, 2026
@ArmandPhilippot ArmandPhilippot added add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) minor-release For the next minor release; in the milestone, "merge queue" = approved for merging on release day. labels Apr 16, 2026
@gllmt
Copy link
Copy Markdown
Author

gllmt commented Apr 16, 2026

Thanks for the suggestions, that makes sense.

I’ve applied the updates:

  • aligned the docs style for RenderOptions.waitUntil()
  • replaced the snippet with a concrete adapter server entrypoint example
  • updated the intro to reference both waitUntil() and the adapter entrypoint docs
  • updated the PR body to follow the docs template

pnpm check passes.

@gllmt gllmt requested a review from ArmandPhilippot April 17, 2026 06:56
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

add new content Document something that is not in docs. May require testing, confirmation, or affect other pages. merge-on-release Don't merge this before the feature is released! (MQ=approved but WAIT for feature release!) minor-release For the next minor release; in the milestone, "merge queue" = approved for merging on release day.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants