-
Notifications
You must be signed in to change notification settings - Fork 550
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
toPng keeps generating the first downloaded ref even though refs passed are different #431
Comments
Thanks for opening your first issue here! If you're reporting a 🐞 bug, please make sure you include steps to reproduce it. We get a lot of issues on this repo, so please be patient and we will get back to you as soon as we can. |
The issue is coming from the fact that the image inside the div is a next Image component. Using backgroundImage works. Is there a reason why with next Image component, toPng cannot process it? |
Hi, @callmejumeh I stumbled upon this issue recently and I believe the underlying cause is the same. Assuming that you're using the default loader for your Next.JS Next.JS For example, the
I suspect that html-to-image has a global cache that caches the images using the pathname only. That’s why html-to-image includes the Setting |
You guys are life savers! Setting |
THANK YOU for raising this question and the solution! I was also running into this problem. Except in my case, I would have multiple But setting |
The problem is straightforward.
I have a list of refs linked to a div each (1 div = 1 ref).
Let's say 3 divs with a ref each.
When I convert div1 toPng for the first time - everything works, the image represents div1.
But after the first download if I try to download another div (div2 for example), it generates div1 again.
I have checked my ref right before converting toPng and the correct div/ref is being passed.
Expected Behavior
toPng should generate the ref passed in arguments
Current Behavior
toPng generate the ref passed as argument for the first tine only.
Then it keeps generating the first downloaded ref even though the ref passed in argument is different.
Possible Solution
html2canvas managed to do the job so I assume nothing is wrong with my refs.
Steps To Reproduce
Error Message & Stack Trace
Additional Context
Would be happy to compensate the genius mind that would fix the issue ;)
Your Environment
The text was updated successfully, but these errors were encountered: