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

Unconditionally updating element attrs causes side effects #32

Closed
spiffytech opened this issue Dec 9, 2021 · 0 comments · Fixed by #34
Closed

Unconditionally updating element attrs causes side effects #32

spiffytech opened this issue Dec 9, 2021 · 0 comments · Fixed by #34

Comments

@spiffytech
Copy link
Member

spiffytech commented Dec 9, 2021

Sandbox

Every time an <img>'s src attribute is set (even if unchanged), that image gets loaded again (load event is fired). If the image wasn't successfully loaded last time, the browser hits the network to try loading it again.

Because Forgo sets all attributes during every render, every render triggers the onload handler, and additionally hits the network if the image 404'd or similar.

In the sandbox you can see in the console after pressing buttons (2) or (3) that the image events fire based on attrs changes, regardless of whether Forgo is involved. Button (1) shows the 404 behavior in the network inspector.

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 a pull request may close this issue.

1 participant