Skip to content

onLoad listener isn't removed after unmount #3141

@colinaaa

Description

@colinaaa
  • Check if updating to the latest Preact version resolves the issue

Describe the bug
The onLoad listener for <img /> isn't removed after <img /> unmount.

timeline:

img mount -> start loading image -> img unmount -> finish loading image -> onLoad fires

To Reproduce
https://codesandbox.io/s/kind-jepsen-kqwte?file=/src/index.js

Steps to reproduce the behavior:

  1. Keep refresh the page, and at some time the imgRef === null, which means when onLoad fires, <img /> is already unmounted

Expected behavior
all listeners (including onLoad) should be removed or not fired after unmount

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions