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

plugin appears to disable browser caching #40

Open
mgenev opened this issue Dec 6, 2016 · 1 comment
Open

plugin appears to disable browser caching #40

mgenev opened this issue Dec 6, 2016 · 1 comment

Comments

@mgenev
Copy link

mgenev commented Dec 6, 2016

Someone opened a PR using this plugin on a project I run and it appears that after this plugin is used, the default React and browser behavior of caching the already requested images and instantly displaying them is disabled and the images are re-requested every time I go to this route. Is there a way to preserve this caching so the placeholder shows just once and from then on the cache is used to display the images instantly like React normally does?

@lettertwo
Copy link
Contributor

Hi @mgenev, this component doesn't fundamentally do anything to disable browser caching. In fact, it loads images off DOM, and then inserts the same src into the DOM after that load completes, so the browser actually has to cache the loaded image in order for the component to behave correctly!

It may be that you're seeing the image load twice because browser caching is already disabled, and this component expects it to be enabled in order to avoid a second load.

If this explanation doesn't seem correct to you, can you provide an example or test case that demonstrates the behavior you're seeing?

FWIW, I do think that loading off-DOM was probably a mistake, and that a future version of this component should always load in-DOM, and not rely on browser caching to work at all.

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

No branches or pull requests

2 participants