Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions .changeset/toolbar-client-optimize-deps.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
'astro': patch
---

Adds the dev toolbar entrypoint to the client `optimizeDeps.include` to prevent a full page reload on first navigation during dev
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.

Reword the changeset to make it user-facing. I don't think users need to know about optimizeDeps.include`

Original file line number Diff line number Diff line change
Expand Up @@ -194,10 +194,13 @@ export default {
return;
}

// If the element is an image but not yet loaded, ignore it
// TODO: We shouldn't ignore this, because it is valid for an image to not be loaded at start (e.g. lazy loading)
// If the element is an image that hasn't loaded yet, wait for it so that
// position-based checks (e.g. above/below the fold) have accurate layout data.
if (originalElement.nodeName === 'IMG' && !(originalElement as HTMLImageElement).complete) {
return;
await new Promise<void>((resolve) => {
originalElement.addEventListener('load', () => resolve(), { once: true });
originalElement.addEventListener('error', () => resolve(), { once: true });
});
}

audits.push({
Expand Down
1 change: 1 addition & 0 deletions packages/astro/src/vite-plugin-environment/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ export function vitePluginEnvironment({
include: [
// For the dev toolbar
'astro > html-escaper',
'astro/runtime/client/dev-toolbar/entrypoint.js',
],
exclude: ['astro:*', 'virtual:astro:*', 'astro/virtual-modules/prefetch.js'],
// Astro files can't be rendered on the client
Expand Down
Loading