-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
feat: add streaming arg to createApp() #15483
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
Merged
Merged
Changes from 7 commits
Commits
Show all changes
8 commits
Select commit
Hold shift + click to select a range
a0f9bf8
feat: add streaming arg to createApp()
florian-lefebvre ce9a187
armand's feedback
florian-lefebvre 51b189c
Merge branch 'main' into feat/create-app-streaming-argument
florian-lefebvre 8705d96
Merge branch 'main' into feat/create-app-streaming-argument
florian-lefebvre e5430fe
wip
florian-lefebvre 471d357
Apply suggestions from code review
florian-lefebvre 3501600
Update .changeset/warm-donuts-learn.md
florian-lefebvre ba08958
Update .changeset/warm-donuts-learn.md
florian-lefebvre File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,20 @@ | ||
| --- | ||
| 'astro': minor | ||
| --- | ||
|
|
||
| Adds `streaming` option to the `createApp()` function in the Adapter API, mirroring the same functionality available when creating a new `App` instance | ||
|
|
||
|
|
||
| An adapter's `createApp()` function now accepts `streaming` (defaults to `true`) as an option. HTML streaming breaks a document into chunks to send over the network and render on the page in order. This normally results in visitors seeing your HTML as fast as possible but factors such as network conditions and waiting for data fetches can block page rendering. | ||
|
|
||
| HTML streaming helps with performance and generally provides a better visitor experience. In most cases, disabling streaming is not recommended. | ||
|
|
||
| However, when you need to disable HTML streaming (e.g. your host only supports non-streamed HTML caching at the CDN level), you can opt out of the default behavior by passing `streaming: false` to `createApp()`: | ||
|
|
||
| ```ts | ||
| import { createApp } from 'astro/app/entrypoint' | ||
|
|
||
| const app = createApp({ streaming: false }) | ||
| ``` | ||
|
florian-lefebvre marked this conversation as resolved.
|
||
|
|
||
| See more about [the `createApp()` function](https://v6.docs.astro.build/en/reference/adapter-reference/#createapp) in the Adapter API reference. | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,4 +1,4 @@ | ||
| import { createApp as _createApp } from 'virtual:astro:app'; | ||
| import type { BaseApp } from '../../base.js'; | ||
| import type { CreateApp } from '../../types.js'; | ||
|
|
||
| export const createApp: () => BaseApp = _createApp; | ||
| export const createApp: CreateApp = _createApp; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,7 +1,7 @@ | ||
| import { manifest } from 'virtual:astro:manifest'; | ||
| import type { BaseApp } from '../../base.js'; | ||
| import type { CreateApp } from '../../types.js'; | ||
| import { App } from '../../app.js'; | ||
|
|
||
| export function createApp(): BaseApp { | ||
| return new App(manifest); | ||
| } | ||
| export const createApp: CreateApp = ({ streaming } = {}) => { | ||
| return new App(manifest, streaming); | ||
| }; |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.