Skip to content
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

feat: allow to specify preload fetch priority #989

Merged
merged 5 commits into from May 2, 2024

Conversation

dargmuesli
Copy link
Member

I'd like to be able to set the fetch priority for preloaded images. This is a quick draft of an implementation. Happy to hear feedback ❤️

@Baroshem
Copy link
Contributor

@dargmuesli What would be the reason to have this functionality?

If you set preload it would most probably mean that you would like the image to have a high priority IMO.

Setting it to auto may result in some issues of having a preload and fetchPriority low.

If I get this completely wrong, please let me know. Maybe I am missing something :)

@dargmuesli
Copy link
Member Author

Of course the main goal is to be able to specify "high" fetch priority for a preloaded image. I just included "low" and "auto" as it's part of the specification.

@Baroshem
Copy link
Contributor

Baroshem commented Sep 16, 2023

@dargmuesli Isnt it set already by default? I thought it is set like that when passing preload.

I was looking recently at the unpic library where this is done automatically so maybe I assumed that it is done here as well: If it doesnt work like that, please ignore my previous comment and proceed with thw implementation.

Just review the question from Daniel and you should be good to go 😉

Also, I just noticed an issue with the GitHub Actions. Could you check this out as well?

Copy link
Contributor

@Baroshem Baroshem left a comment

Choose a reason for hiding this comment

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

Some comments from my side

@dargmuesli
Copy link
Member Author

dargmuesli commented Sep 16, 2023

I tried it in Firefox. Using preload only let the request have low priority afair, setting it to high made let it be of high priority.

@Javid-Izadfar
Copy link

any resolution for this PR?

@dargmuesli
Copy link
Member Author

I resolved the merge conflicts. Reviews welcome!

@dargmuesli
Copy link
Member Author

I'm not sure, but to me it looks like the netlify image cdn snapshot need to be updated. If that's incorrect, I'd need assistance to understand how to fix the pipeline instead 🙏

@codecov-commenter
Copy link

codecov-commenter commented Apr 17, 2024

Codecov Report

Attention: Patch coverage is 50.00000% with 6 lines in your changes are missing coverage. Please review.

Project coverage is 59.63%. Comparing base (5262730) to head (f63fc2a).

Files Patch % Lines
src/runtime/components/nuxt-img.ts 0.00% 3 Missing ⚠️
src/runtime/components/nuxt-picture.ts 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #989      +/-   ##
==========================================
- Coverage   59.66%   59.63%   -0.04%     
==========================================
  Files          78       78              
  Lines        5080     5091      +11     
  Branches      409      409              
==========================================
+ Hits         3031     3036       +5     
- Misses       2019     2025       +6     
  Partials       30       30              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@@ -94,6 +94,9 @@ export default defineComponent({
imagesizes: sizes.value.sizes,
imagesrcset: sizes.value.srcset,
}),
...(typeof props.preload !== 'boolean' && props.preload.fetchPriority
? { fetchpriority: props.preload.fetchPriority }
: {}),
Copy link
Member

Choose a reason for hiding this comment

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

should we default to fetchpriority: 'high'?

Copy link
Member Author

Choose a reason for hiding this comment

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

Sorry for not answering in time, this comment fell off my radar 🌠

Copy link
Member

Choose a reason for hiding this comment

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

Still time to update - what do you think?

Copy link
Member Author

Choose a reason for hiding this comment

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

Why should the fetch priority default to high in your opinion? I'd say we can just leave it for the users to decide if they want to specify any.

@danielroe danielroe merged commit b29cb33 into nuxt:main May 2, 2024
1 check passed
@github-actions github-actions bot mentioned this pull request May 2, 2024
@dargmuesli dargmuesli deleted the feat/fetch-priority branch May 2, 2024 13:49
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.

None yet

5 participants