Skip to content

fix: lazy load images by default and add priority prop#16

Open
maiieul wants to merge 2 commits into
mainfrom
fix/lazy-loading-default
Open

fix: lazy load images by default and add priority prop#16
maiieul wants to merge 2 commits into
mainfrom
fix/lazy-loading-default

Conversation

@maiieul

@maiieul maiieul commented Jun 11, 2026

Copy link
Copy Markdown
Member

What is it?

  • Bug

Description

The README documents loading as defaulting to lazy, but the component never set it — so every image loaded eagerly, including below-the-fold ones, which hurts LCP. Images now render loading="lazy" by default (matching next/image, NgOptimizedImage, Astro, Gatsby and Unpic), and the new priority prop renders loading="eager" + fetchpriority="high" for above-the-fold/LCP images. Explicit loading/fetchpriority props still take precedence.

Since this changes the rendered HTML for every consumer it should ship as a major. Migration is one line: add priority to your hero/LCP images.

The README documented loading as defaulting to lazy but the component
never set it, so every image loaded eagerly. Images now render
loading="lazy" by default; the new priority prop renders
loading="eager" + fetchpriority="high" for above-the-fold/LCP images.
Explicit loading/fetchpriority props take precedence.

BREAKING CHANGE: images lazy-load by default; add priority to
above-the-fold/LCP images.
@changeset-bot

changeset-bot Bot commented Jun 11, 2026

Copy link
Copy Markdown

🦋 Changeset detected

Latest commit: f9074f7

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 1 package
Name Type
qwik-image Major

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

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Pull request overview

Updates the qwik-image component to default to lazy-loading (matching the README and common image-component defaults) and introduces a priority prop for above-the-fold/LCP images, along with release tooling to ship this as a major version.

Changes:

  • Default <Image> rendering now includes loading="lazy"; priority renders loading="eager" + fetchpriority="high" while preserving explicit loading/fetchpriority.
  • Adds test coverage for default lazy behavior, priority behavior, and explicit override precedence.
  • Introduces Changesets configuration + pnpm workspace setup to support major-version publishing.

Reviewed changes

Copilot reviewed 10 out of 11 changed files in this pull request and generated 1 comment.

Show a summary per file
File Description
README.md Documents new priority prop behavior and guidance for LCP images.
packages/qwik-image/src/lib/image.tsx Implements default loading="lazy" and priority prop mapping to eager/high.
apps/qwik-demo-app/src/components/image.spec.tsx Adds tests covering default loading, priority, and explicit overrides.
apps/qwik-demo-app/src/routes/index.tsx Uses priority in the demo route for the main image.
apps/qwik-demo-app/vite.config.ts Adds a Vitest-only alias to avoid a node-environment crash.
package.json Adds @changesets/cli dev dependency.
pnpm-workspace.yaml Adds pnpm workspace definition.
pnpm-lock.yaml Lockfile updates for workspace + Changesets.
.changeset/config.json Adds Changesets configuration.
.changeset/lazy-loading-default.md Declares a major release for the default lazy-loading change + priority.
.changeset/README.md Adds Changesets folder README.
Files not reviewed (1)
  • pnpm-lock.yaml: Language not supported

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread pnpm-workspace.yaml
Comment on lines +1 to +2
packages:
- 'packages/*'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants