-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
QImg loads twice when source changes #7053
Comments
It doesn't do anything like this - please check your browser extensions. |
Okay ... tested with fresh browser without any extensions installed. It depends on cache mode in DevTools. If you deactive cache, you get this behavior. So, I guess, this is no real bug. |
Excuse me, but I think there's already a problem. The images are loaded twice or more in Safari. I can also see this behaviour on the iPhone in Safari and as far as i know, there is no option on iOS to disable the cache or something like that. I am pretty sure changing src triggers multiple times. Even if cache is disabled, Vue/Quasar should not load the image multiple times. |
@maisen20 cab you provide a screenshot from the dev tools, network tab? All the calls except the first should be already cached. |
Pretty sure the problem comes from the file "vue.runtime.esm.js". I don't know exactly what this file and all its functions are needed for, but I found the one where the problem originated. The QImg components are included by QImg.js as div tags in the document, then all style properties of the component are run through by vue.runtime.esm.js - And that's where the "problem" seems to be. The Safari browser will probably reload the (already loaded) background image. Can this be? Does anyone have an idea what I can do? |
Sorry for all the posts, but this behaviour in the Safari browser can also be observed directly on https://quasar.dev/vue-components/img#Example--Basic When I click on the trigger button in the "Transitions" section of this website, I see in the Firefox console under "Network" that the next image is loaded once. If I now do the same steps in the Safari browser, I see that the image is always loaded twice. And i didn't disabled ressource caching. |
Any news about this issue? |
I ran into this. I tested various scenarios (e.g. Why is this happening?The way Chrome actually detects this as two different requests for the image (one for PS. It doesn't happen very consistently. I have seen this simply not happening on What can you do about it?Good News: It's not as bad as it sounds!You will only see this in Chrome DevTools when you have "Disable Cache" on! In production, it loads the second time from the cache. (also noted here: tuupola/lazyload#158 (comment)) Solution 1) Do nothing!It will keep bothering you if you have "Disable Cache" checked (which most developers do!) But, in production reality to the users, it will be cached the second time by the browser just like a lot of other things during a re-render. Solution 2) Use
|
Please upgrade to Quasar v2 which has a completely different approach (way more efficient). This is due to the fact that we don't have to support IE11 anymore. |
Describe the bug
QImg is loading the given source twice when source changes.
Codepen/jsFiddle/Codesandbox (required)
https://quasar.dev/vue-components/img#Example--Basic
To Reproduce
Expected behavior
Platform (please complete the following information):
OS: Windows 10 1909
Browsers: Edge Chromium v81.0.416.72, Google Chrome v81.0.4044.138
The text was updated successfully, but these errors were encountered: