jessuni / shikwasa

An audio player born for podcast
https://shikwasa.js.org
MIT License
476 stars 30 forks source link

[Bug Report] player icons destroy unexpected #44

Closed walkdoer closed 2 years ago

walkdoer commented 2 years ago

Hi @jessuni

I came across one issue in my project, the buttons of the player was missing when another player destroyed.

And I found the issue is that the icons will only has one instance in DOM tree, and when one player destory, the icons' svg will also destroy, therefor will affect another player in the page.

constructor(options) {
    this.mounted = false

    // because of this line, can only has one icons in dom tree.
    if (!document.querySelector('.shk-icons')) {
      this.icons = createElement({
        className: 'shk-icons',
        innerHTML: IconComp,
      })
    }
    this.initEl()
    this.initOptions(options)
}

mount(container, supportsPassive) {
    // ...
    if (this.icons) {
      container.append(this.icons)
    }
   // ...
  }

Shikwasa is awesome, thanks for your work. 🙏

jessuni commented 2 years ago

A fix will follow up. Thanks!

walkdoer commented 2 years ago

Thanks @jessuni , The problem was solved 👍 🌹